Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Alto
/
fenixconsulting
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit bf6d2bc4
authored
2022-09-27 17:42:04 +0300
by
Alto
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Убрал деф значения, добавил ползунок для моб
1 parent
8bb160d5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
16 deletions
wp-content/themes/fenixmedica/assets/js/script.js
wp-content/themes/fenixmedica/inc/calc.php
wp-content/themes/fenixmedica/assets/js/script.js
View file @
bf6d2bc
...
...
@@ -102,13 +102,38 @@ $(document).ready(
//Маска ввода телефона
$
(
'input[name="phone"]'
).
inputmask
({
"mask"
:
"+7 (999) 999-99-99"
});
function
fenix_check
(
el_input
)
{
if
(
$
(
el_input
).
length
==
0
)
el_input
=
$
(
'.fenix_calc input[type="number"][min][max]'
);
$
(
el_input
).
each
(
function
()
{
var
inp_val
=
$
(
this
).
val
();
var
inp_val_int
=
inp_val
|
0
;
var
inp_min
=
$
(
this
).
attr
(
'min'
)
|
0
;
var
inp_max
=
$
(
this
).
attr
(
'max'
)
|
0
;
var
inp_range
=
$
(
this
).
next
(
'input[type="range"]'
);
var
inp_range_val
=
$
(
inp_range
).
val
();
if
(
inp_val_int
<
inp_min
)
inp_val_int
=
inp_min
;
if
(
inp_val_int
>
inp_max
)
inp_val_int
=
inp_max
;
if
((
inp_val
).
toString
()
!=
(
inp_val_int
).
toString
())
$
(
this
).
val
(
inp_val_int
);
if
((
inp_range
).
toString
()
!=
(
inp_val_int
).
toString
())
$
(
inp_range
).
val
(
inp_val_int
);
}
);
$
(
'.fenix_calc .calc_btn'
).
toggleClass
(
'disabled'
,
$
(
'.fenix_calc input[type="number"][min][max]:invalid'
).
length
>
0
);
}
function
fenix_calc
(
el_wrap
)
{
if
(
el_wrap
.
length
>
0
)
{
var
el_table
=
el_wrap
.
find
(
'.table_result'
)
fenix_check
();
var
el_table
=
el_wrap
.
find
(
'.table_result'
);
var
calc_credit
=
parseInt
(
el_wrap
.
find
(
'input[name="calc_credit"]'
).
val
())
|
0
;
var
calc_inv
=
parseInt
(
el_wrap
.
find
(
'input[name="calc_inv"]'
).
val
())
|
0
;
var
calc_s
=
parseInt
(
el_wrap
.
find
(
'input[name="calc_s"]'
).
val
())
|
0
;
...
...
@@ -218,20 +243,21 @@ $(document).ready(
fenix_calc
(
$
(
this
).
closest
(
'.fenix_calc'
));
}
).
on
(
[
'change.fenix'
,
'blur.fenix'
].
join
(
' '
),
'.fenix_calc input[type="number"][min][max]'
,
function
()
{
var
inp_val
=
$
(
this
).
val
();
var
inp_val_int
=
inp_val
|
0
;
var
inp_min
=
$
(
this
).
attr
(
'min'
)
|
0
;
var
inp_max
=
$
(
this
).
attr
(
'max'
)
|
0
;
if
(
inp_val_int
<
inp_min
)
inp_val_int
=
inp_min
;
if
(
inp_val_int
>
inp_max
)
inp_val_int
=
inp_max
;
if
((
inp_val
).
toString
()
!=
(
inp_val_int
).
toString
())
$
(
this
).
val
(
inp_val_int
);
fenix_check
(
this
);
}
).
on
(
'change.fenix'
,
'.fenix_calc input[type="range"][min][max]'
,
function
()
{
$
(
this
).
prev
(
'input[type="number"][min][max]'
).
val
(
$
(
this
).
val
());
}
);
}
...
...
wp-content/themes/fenixmedica/inc/calc.php
View file @
bf6d2bc
...
...
@@ -20,14 +20,17 @@ function fenix_calc ($atts, $content)
'<div class="mb-3 d-none">'
.
'<label for="calc_inv_'
.
$atts
[
'id'
]
.
'" class="form-label mb-3">Поступление кредита, руб</label>'
.
'<input type="number" 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" />'
.
'<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="number" class="form-control rounded-pill p-2 px-4" id="calc_inv_'
.
$atts
[
'id'
]
.
'" name="calc_inv" required="required" value="10000000" min="10000000" max="250000000" />'
.
'<input type="number" class="form-control rounded-pill p-2 px-4" id="calc_inv_'
.
$atts
[
'id'
]
.
'" name="calc_inv" required="required" value="" min="10000000" max="250000000" />'
.
'<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="500" min="250" max="3000" />'
.
'<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>'
.
...
...
@@ -35,7 +38,8 @@ function fenix_calc ($atts, $content)
'</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="15" min="0" max="100" />'
.
'<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">'
.
...
...
@@ -49,7 +53,7 @@ function fenix_calc ($atts, $content)
'</div>'
.
'<div class="row">'
.
'<div class="col-12">'
.
'<button name="calc" type="button" class="btn btn-lg btn-style-0 rounded-pill calc_btn" role="button" id="calc_btn_'
.
$atts
[
'id'
]
.
'">Рассчитать</button>'
.
'<button name="calc" type="button" class="btn btn-lg btn-style-0 rounded-pill calc_btn
disabled
" role="button" id="calc_btn_'
.
$atts
[
'id'
]
.
'">Рассчитать</button>'
.
'</div>'
.
'</div>'
.
'</div>'
;
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment