| Line -... |
Line 1... |
| - |
|
1 |
<script>
|
| - |
|
2 |
$(document).ready(function() {
|
| - |
|
3 |
var max_fields = 10; //maximum input boxes allowed
|
| - |
|
4 |
var wrapper = $(".input_fields_wrap"); //Fields wrapper
|
| - |
|
5 |
var add_button = $(".add_field_button"); //Add button ID
|
| - |
|
6 |
|
| - |
|
7 |
var x = 1; //initlal text box count
|
| - |
|
8 |
$(add_button).click(function(e){ //on add input button click
|
| - |
|
9 |
e.preventDefault();
|
| - |
|
10 |
if(x < max_fields){ //max input box allowed
|
| - |
|
11 |
x++; //text box increment
|
| - |
|
12 |
$(wrapper).append('<div><b>Category</b> <select name="data[FeaturedDeal][cat_rank][]"><option value="Mobile">Mobile</option><option value="Tablet">Tablet</option><option value="Accessories">Accessories</option></select><br><input type="text" name="data[FeaturedDeal][myrank][]"/><a href="#" class="remove_field">Remove</a></div>'); //add input box
|
| - |
|
13 |
}
|
| - |
|
14 |
});
|
| - |
|
15 |
|
| - |
|
16 |
$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
|
| - |
|
17 |
e.preventDefault(); $(this).parent('div').remove(); x--;
|
| - |
|
18 |
})
|
| - |
|
19 |
});
|
| - |
|
20 |
</script>
|
| 1 |
<div class="container">
|
21 |
<div class="container">
|
| 2 |
<div class="row">
|
22 |
<div class="row">
|
| 3 |
<div class="col-lg-3">
|
23 |
<div class="col-lg-3">
|
| 4 |
<?php echo $this->Element('adminactions');?>
|
24 |
<?php echo $this->Element('adminactions');?>
|
| 5 |
</div>
|
25 |
</div>
|
| Line 8... |
Line 28... |
| 8 |
<fieldset>
|
28 |
<fieldset>
|
| 9 |
<legend><?php echo __('Add Featured Deal'); ?></legend>
|
29 |
<legend><?php echo __('Add Featured Deal'); ?></legend>
|
| 10 |
<?php
|
30 |
<?php
|
| 11 |
echo $this->Form->input('skuBundleId',array('type'=>'number'));
|
31 |
echo $this->Form->input('skuBundleId',array('type'=>'number'));
|
| 12 |
//echo $this->Form->input('FeaturedDeal.rankDetails.0',array('type'=>'number','label'=>'Default Rank'));
|
32 |
//echo $this->Form->input('FeaturedDeal.rankDetails.0',array('type'=>'number','label'=>'Default Rank'));
|
| 13 |
// $options = array(
|
33 |
//$options = array(
|
| 14 |
// '3' => 'Mobiles',
|
34 |
// '3' => 'Mobiles',
|
| 15 |
// '5' => 'Tablets'
|
35 |
// '5' => 'Tablets'
|
| 16 |
// );
|
36 |
//);
|
| 17 |
|
37 |
|
| 18 |
// $attributes = array(
|
38 |
// $attributes = array(
|
| 19 |
// 'legend' => false,
|
39 |
// 'legend' => false,
|
| 20 |
// 'value' => 3,
|
40 |
// 'value' => 3,
|
| 21 |
// 'class' => 'catselect'
|
41 |
// 'class' => 'catselect'
|
| 22 |
// );
|
42 |
// );
|
| 23 |
// echo $this->Form->radio('type',$options,$attributes);
|
43 |
// echo $this->Form->radio('type',$options,$attributes);
|
| 24 |
// echo $this->Form->input('FeaturedDeal.rankDetails',array('type'=>'number','label'=>'Rank','class'=>'categoryRank'));
|
44 |
// // echo $this->Form->input('FeaturedDeal.rankDetails',array('type'=>'number','label'=>'Rank','class'=>'categoryRank'));
|
| 25 |
// echo $this->Form->input('FeaturedDeal.rankDetails.3',array('type'=>'number','label'=>'Mobiles Rank','class' => 'categoryRank'));
|
45 |
// echo $this->Form->input('FeaturedDeal.rankDetails.3',array('type'=>'number','label'=>'Mobiles Rank','class' => 'categoryRank'));
|
| 26 |
// echo $this->Form->input('FeaturedDeal.rankDetails.5',array('type'=>'number','label'=>'Tablets Rank','class'=>'categoryRank','disabled'=>true));
|
46 |
// echo $this->Form->input('FeaturedDeal.rankDetails.5',array('type'=>'number','label'=>'Tablets Rank','class'=>'categoryRank','disabled'=>true));
|
| 27 |
echo $this->Form->input('startDate',array('type'=>'datetime','timeFormat'=>24));
|
47 |
echo $this->Form->input('startDate',array('type'=>'datetime','timeFormat'=>24));
|
| 28 |
echo $this->Form->input('endDate',array('type'=>'datetime','timeFormat'=>24));
|
48 |
echo $this->Form->input('endDate',array('type'=>'datetime','timeFormat'=>24));
|
| 29 |
echo $this->Form->input('thresholdPrice',array('type'=>'number'));
|
49 |
echo $this->Form->input('thresholdPrice',array('type'=>'number'));
|
| 30 |
echo $this->Form->input('Mobiles',array('type'=>'number','value'=>0));
|
50 |
echo $this->Form->input('Mobiles',array('type'=>'number','value'=>0));
|
| 31 |
echo $this->Form->input('Tablets',array('type'=>'number','value'=>0));
|
51 |
echo $this->Form->input('Tablets',array('type'=>'number','value'=>0));
|
| 32 |
echo $this->Form->input('Accessories',array('type'=>'number','value'=>0));
|
52 |
echo $this->Form->input('Accessories',array('type'=>'number','value'=>0));
|
| 33 |
// echo $this->Form->input('multi',array('type'=>'checkbox'));
|
53 |
// echo $this->Form->input('multi',array('type'=>'checkbox'));
|
| 34 |
?>
|
54 |
?>
|
| - |
|
55 |
<div class="input_fields_wrap">
|
| - |
|
56 |
<button class="add_field_button">Add More Fields</button>
|
| - |
|
57 |
</div>
|
| 35 |
</fieldset>
|
58 |
</fieldset>
|
| 36 |
<?php echo $this->Form->end(__('Submit')); ?>
|
59 |
<?php echo $this->Form->end(__('Submit')); ?>
|
| 37 |
</div>
|
60 |
</div>
|
| 38 |
</div>
|
61 |
</div>
|
| 39 |
</div>
|
62 |
</div>
|
| Line 44... |
Line 67... |
| 44 |
var that = $(this);
|
67 |
var that = $(this);
|
| 45 |
$('.categoryRank').prop('disabled',true).val('');
|
68 |
$('.categoryRank').prop('disabled',true).val('');
|
| 46 |
$('#FeaturedDealRankDetails'+$(this).val()).prop('disabled',false);
|
69 |
$('#FeaturedDealRankDetails'+$(this).val()).prop('disabled',false);
|
| 47 |
})
|
70 |
})
|
| 48 |
})
|
71 |
})
|
| 49 |
</script>
|
72 |
</script>
|
| 50 |
|
73 |
|