0.0.34 forms

This commit is contained in:
SBD
2025-01-15 20:51:50 +03:00
parent 575ee074b1
commit 8f3bba620c
10 changed files with 76 additions and 35 deletions

View File

@@ -26,6 +26,7 @@
--route-btn-border-radius: 10px;
--route-btn-padding: 7.5px 0;
--route-btn-width: 171px;
--route-btn-height: 100%;
--route-btn-bg: #FFFFFF;
--route-btn-hover-bg: #FF613A;
--route-btn-hover-text-color: #FFFFFF;
@@ -213,36 +214,53 @@
align-items: center;
gap: 20px;
}
.route_btn{
cursor: pointer;
&.solid{
--route-btn-width: 222px;
--route-btn-padding: 12px 0;
--route-btn-bg: #FF613A;
--route-btn-title-color: #ffffff;
}
width: var(--route-btn-width);
border: var(--route-btn-border);
border-radius: var(--route-btn-border-radius);
padding: var(--route-btn-padding);
background: var(--route-btn-bg);
height: 100%;
text-align: center;
transition: 200ms all;
}
.route_btn{
cursor: pointer;
&.solid{
--route-btn-width: 222px;
--route-btn-padding: 12px 0;
--route-btn-bg: #FF613A;
--route-btn-title-color: #ffffff;
}
&.inactive{
cursor: default;
--route-btn-title-color: #27242499;
--route-btn-border: 1.5px solid #FF613A99;
}
width: var(--route-btn-width);
border: var(--route-btn-border);
border-radius: var(--route-btn-border-radius);
padding: var(--route-btn-padding);
background: var(--route-btn-bg);
height: var(--route-btn-height);
text-align: center;
transition: 200ms all;
&:has(img){
display: flex;
gap: 5px;
align-items: center;
justify-content: center;
text-align: unset;
}
&:not(&.inactive){
&:hover{
background: var(--route-btn-hover-bg);
.route_btn_title{color: var(--route-btn-hover-text-color);}
.route_btn_data{color: var(--route-btn-hover-text-color);}
box-shadow: 0 4px 4px rgba(189, 104, 104, 0.25);
}
.route_btn_title{
color: var(--route-btn-title-color);
font-size: var(--medium-font-size);
}
.route_btn_data{
font-size: var(--small-font-size);
color: var(--route-btn-text-data-color);
}
.route_btn_title{
color: var(--route-btn-title-color);
font-size: var(--medium-font-size);
&.big{
font-size: var(--big-font-size);
}
}
.route_btn_data{
font-size: var(--small-font-size);
color: var(--route-btn-text-data-color);
}
}
}

View File

@@ -0,0 +1,3 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.965 6.0925C4.045 8.215 5.785 9.9475 7.9075 11.035L9.5575 9.385C9.76 9.1825 10.06 9.115 10.3225 9.205C11.1625 9.4825 12.07 9.6325 13 9.6325C13.4125 9.6325 13.75 9.97 13.75 10.3825V13C13.75 13.4125 13.4125 13.75 13 13.75C5.9575 13.75 0.25 8.0425 0.25 1C0.25 0.5875 0.5875 0.25 1 0.25H3.625C4.0375 0.25 4.375 0.5875 4.375 1C4.375 1.9375 4.525 2.8375 4.8025 3.6775C4.885 3.94 4.825 4.2325 4.615 4.4425L2.965 6.0925Z" fill="#FF613A"/>
</svg>

After

Width:  |  Height:  |  Size: 545 B

View File

@@ -61,15 +61,18 @@ function updateCargoTypeInForm(el, type_transport='') {
let cargo_types = res.cargo_types
if (!cargo_types) return;
resetWRadioInputs('cargo_type');
let $widget = getWRadioInputsWidget('cargo_type');
let $selected_value = $widget.querySelector(".radio.checked")
resetWRadioInputs('cargo_type');
for (let cargo_type of cargo_types) {
let obj = {
name: cargo_type[0],
title: cargo_type[1],
}
let selected = false;
if ($selected_value && $selected_value.closest(".cw_w_radio_inputs_radio_input").dataset.name === obj.name) selected = true;
let html = generateRadioInput(obj)
let html = generateRadioInput(obj, selected)
if ($widget.lastElementChild){
$(html).insertAfter($($widget.lastElementChild))

View File

@@ -35,15 +35,19 @@ function datarangepickerinitAll(){
})
}
function daterangepickerInit(el, callback) {
function daterangepickerInit(el, callback, date) {
let $datarangepicker = el.querySelector('input')
let min_date = moment()
if (date){
min_date = moment(date);
}
$($datarangepicker).daterangepicker({
"autoapply": true,
"linkedCalendars": false,
"singleDatePicker": true,
"timePicker": false,
"timePicker24Hour": false,
"minDate": moment(),
"minDate": moment(date),
"locale": setLocalSets(),
}, function (start, end, label) {
let $parent = el.closest('.w_daterangepicker')

View File

@@ -19,10 +19,10 @@ function chooseRadioInput(el, callback){
if (callback) callback(el, el_name)
}
function generateRadioInput(data){
function generateRadioInput(data, selected){
let html = `
<div class="cw_w_radio_inputs_radio_input" data-name="${data.name}">
<div class="radio" onclick="chooseRadioInput(this, ${data.callback})"></div>
<div class="radio${selected? ' checked' : ''}" onclick="chooseRadioInput(this, ${data.callback})"></div>
<div class="radio_label" onclick="chooseRadioInput(this, ${data.callback})">${data.title}</div>
</div>
`

View File

@@ -87,6 +87,7 @@ function selectCountry(el, callback) {
id: el.dataset.id,
country_code: el.dataset.country_code,
flag: el.dataset.flag,
now: el.dataset.now
}
$flag.src = country_data.flag;
@@ -96,10 +97,21 @@ function selectCountry(el, callback) {
$input.dataset.name = country_data.full_name;
$input.dataset.id = country_data.id;
connectCountryWDateRangePicker(el, country_data)
closeSelectCountry(el);
resetFieldError(el);
}
function connectCountryWDateRangePicker (el, data) {
let $parent = el.closest(".field_container")
if (!$parent || !data || typeof daterangepickerInit === 'undefined') return;
let datepicker_name = $parent.dataset.datepicker;
let $datepicker = $(`.field_container[data-name="${datepicker_name}"]`)[0]
daterangepickerInit($datepicker, false, data.now)
}
function resetCountrySelect(el, callback) {
let $parent = el.closest('.w_select_country');
if (!$parent) return;