calc.php
4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
function fenix_calc ($atts, $content)
{
$atts = shortcode_atts(
array(
'id' => '',
'title' => ''
),
$atts,
'fenix_calc'
);
$out = '';
$out = ''.
'<!--Примеры эффективных-->'.
'<div id="'.$atts['id'].'" class="container fenix_calc">'.
'<div class="row">'.
'<h1>'.$atts['title'].'</h1>'.
'<div class="col-12 col-md-3">'.
'<div class="mb-3 d-none">'.
'<label for="calc_inv_'.$atts['id'].'" class="form-label mb-3">Поступление кредита, руб</label>'.
'<input type="text" class="form-control rounded-pill p-2 px-4" id="calc_credit_'.$atts['id'].'" name="calc_credit" required="required" value="0" min="0" max="10000000" oninput="this.value = this.value.replace(/[^0-9.]/g, \'\').replace(/(\..*?)\..*/g, \'$1\').replace(/^0[^.]/, \'0\');" />'.
'<input type="range" class="form-range d-md-none" min="0" max="10000000" step="1000" id="calc_credit_range_'.$atts['id'].'" />'.
'</div>'.
'<div class="mb-3">'.
'<label for="calc_inv_'.$atts['id'].'" class="form-label mb-3">Инвестиции в проект, тыс. руб</label>'.
'<input type="text" class="form-control rounded-pill p-2 px-4" id="calc_inv_'.$atts['id'].'" name="calc_inv" required="required" value="" min="10000000" max="250000000" oninput="this.value = this.value.replace(/[^0-9.]/g, \'\').replace(/(\..*?)\..*/g, \'$1\').replace(/^0[^.]/, \'0\');" />'.
'<input type="range" class="form-range d-md-none" min="10000000" max="250000000" step="1000" id="calc_inv_range_'.$atts['id'].'" />'.
'</div>'.
'<div class="mb-3">'.
'<label for="calc_s_'.$atts['id'].'" class="form-label mb-3">Площадь помещения, м<sup>2</sup></label>'.
'<input type="number" class="form-control rounded-pill p-2 px-4" id="calc_s_'.$atts['id'].'" name="calc_s" required="required" value="" min="250" max="3000" />'.
'<input type="range" class="form-range d-md-none" min="250" max="3000" step="1" id="calc_s_range_'.$atts['id'].'" />'.
'</div>'.
'<div class="mb-3">'.
'<label for="calc_period_'.$atts['id'].'" class="form-label mb-3">Срок, год</label>'.
'<input type="number" class="form-control rounded-pill p-2 px-4" id="calc_period_'.$atts['id'].'" name="calc_period" required="required" value="5" min="0" max="5" readonly="readonly" />'.
'</div>'.
'<div class="mb-3">'.
'<label for="calc_discont_'.$atts['id'].'" class="form-label mb-3">Ставка дисконтирования, %</label>'.
'<input type="number" class="form-control rounded-pill p-2 px-4" id="calc_discont_'.$atts['id'].'" name="calc_discont" required="required" value="" min="0" max="100" />'.
'<input type="range" class="form-range d-md-none" min="0" max="100" step="1" id="calc_discont_range_'.$atts['id'].'" />'.
'</div>'.
'</div>'.
'<div class="col-12 col-md-9 text-center">'.
'<table class="table table-striped table-hover table-bordered table_result"></table>'.
(
has_post_thumbnail($post->ID)?
'<img src="'.get_the_post_thumbnail_url($post->ID, 'full').'" class="img-fluid mb-4 mb-md-0 img-calc"/>':
''
).
'</div>'.
'</div>'.
'<div class="row">'.
'<div class="col-12">'.
'<button name="calc" type="button" class="btn btn-lg btn-style-0 rounded-pill calc_btn disabled d-block mx-auto mx-md-0" role="button" id="calc_btn_'.$atts['id'].'">Рассчитать</button>'.
'</div>'.
'</div>'.
'</div>';
return $out;
}
add_shortcode('fenix_calc', 'fenix_calc');