| 17760 |
amit.gupta |
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>
|
| 14517 |
anikendra |
21 |
<div class="container">
|
|
|
22 |
<div class="row">
|
|
|
23 |
<div class="col-lg-3">
|
|
|
24 |
<?php echo $this->Element('adminactions');?>
|
|
|
25 |
</div>
|
|
|
26 |
<div class="col-lg-9">
|
|
|
27 |
<?php echo $this->Form->create('FeaturedDeal'); ?>
|
|
|
28 |
<fieldset>
|
|
|
29 |
<legend><?php echo __('Add Featured Deal'); ?></legend>
|
|
|
30 |
<?php
|
| 17344 |
naman |
31 |
echo $this->Form->input('skuBundleId',array('type'=>'number'));
|
| 17471 |
manish.sha |
32 |
//echo $this->Form->input('FeaturedDeal.rankDetails.0',array('type'=>'number','label'=>'Default Rank'));
|
| 17760 |
amit.gupta |
33 |
//$options = array(
|
|
|
34 |
// '3' => 'Mobiles',
|
|
|
35 |
// '5' => 'Tablets'
|
|
|
36 |
//);
|
| 14533 |
anikendra |
37 |
|
| 17760 |
amit.gupta |
38 |
// $attributes = array(
|
|
|
39 |
// 'legend' => false,
|
|
|
40 |
// 'value' => 3,
|
|
|
41 |
// 'class' => 'catselect'
|
|
|
42 |
// );
|
|
|
43 |
// echo $this->Form->radio('type',$options,$attributes);
|
|
|
44 |
// // echo $this->Form->input('FeaturedDeal.rankDetails',array('type'=>'number','label'=>'Rank','class'=>'categoryRank'));
|
|
|
45 |
// echo $this->Form->input('FeaturedDeal.rankDetails.3',array('type'=>'number','label'=>'Mobiles Rank','class' => 'categoryRank'));
|
|
|
46 |
// echo $this->Form->input('FeaturedDeal.rankDetails.5',array('type'=>'number','label'=>'Tablets Rank','class'=>'categoryRank','disabled'=>true));
|
| 14517 |
anikendra |
47 |
echo $this->Form->input('startDate',array('type'=>'datetime','timeFormat'=>24));
|
|
|
48 |
echo $this->Form->input('endDate',array('type'=>'datetime','timeFormat'=>24));
|
|
|
49 |
echo $this->Form->input('thresholdPrice',array('type'=>'number'));
|
| 17471 |
manish.sha |
50 |
echo $this->Form->input('Mobiles',array('type'=>'number','value'=>0));
|
|
|
51 |
echo $this->Form->input('Tablets',array('type'=>'number','value'=>0));
|
|
|
52 |
echo $this->Form->input('Accessories',array('type'=>'number','value'=>0));
|
| 17344 |
naman |
53 |
// echo $this->Form->input('multi',array('type'=>'checkbox'));
|
| 14517 |
anikendra |
54 |
?>
|
| 17760 |
amit.gupta |
55 |
<div class="input_fields_wrap">
|
|
|
56 |
<button class="add_field_button">Add More Fields</button>
|
|
|
57 |
</div>
|
| 14517 |
anikendra |
58 |
</fieldset>
|
|
|
59 |
<?php echo $this->Form->end(__('Submit')); ?>
|
|
|
60 |
</div>
|
|
|
61 |
</div>
|
|
|
62 |
</div>
|
|
|
63 |
</div>
|
|
|
64 |
<script type="text/javascript">
|
|
|
65 |
$(function(){
|
| 14533 |
anikendra |
66 |
$(document).on('click','.catselect',function(){
|
| 14517 |
anikendra |
67 |
var that = $(this);
|
| 14533 |
anikendra |
68 |
$('.categoryRank').prop('disabled',true).val('');
|
|
|
69 |
$('#FeaturedDealRankDetails'+$(this).val()).prop('disabled',false);
|
| 14517 |
anikendra |
70 |
})
|
|
|
71 |
})
|
| 17760 |
amit.gupta |
72 |
</script>
|