| 1 |
jQuery(document).ready(function ($) { |
| 2 |
let entitlements = [ |
| 3 |
{ |
| 4 |
value: "AAM", |
| 5 |
text: "Alanyi adómentesség" |
| 6 |
}, |
| 7 |
{ |
| 8 |
value: "ANTIQUES", |
| 9 |
text: "Különbözet szerinti szabályozás - gyűjteménydarabok és régiségek" |
| 10 |
}, |
| 11 |
{ |
| 12 |
value: "ARTWORK", |
| 13 |
text: "Különbözet szerinti szabályozás - műalkotások" |
| 14 |
}, |
| 15 |
{ |
| 16 |
value: "ATK", |
| 17 |
text: "Áfa tv. tárgyi hatályán kívüli ügylet" |
| 18 |
}, |
| 19 |
{ |
| 20 |
value: "EAM", |
| 21 |
text: "Áfamentes termékexport, azzal egy tekintet alá eső értékesítések, nemzetközi közlekedéshez kapcsolódó áfamentes ügyletek (Áfa tv. 98-109. §)" |
| 22 |
}, |
| 23 |
{ |
| 24 |
value: "EUE", |
| 25 |
text: "EU más tagállamában áfaköteles (áfa fizetésére az értékesítő köteles)" |
| 26 |
}, |
| 27 |
{ |
| 28 |
value: "EUFAD37", |
| 29 |
text: "Áfa tv. 37. § (1) bekezdése alapján a szolgáltatás teljesítése helye az EU más tagállama (áfa fizetésére a vevő köteles)" |
| 30 |
}, |
| 31 |
{ |
| 32 |
value: "EUFADE", |
| 33 |
text: "Áfa tv. szerint egyéb rendelkezése szerint a teljesítés helye EU más tagállama (áfa fizetésére a vevő köteles)" |
| 34 |
}, |
| 35 |
{ |
| 36 |
value: "HO", |
| 37 |
text: "Áfa tv. szerint EU-n kívül teljesített ügylet" |
| 38 |
}, |
| 39 |
{ |
| 40 |
value: "KBAET", |
| 41 |
text: "Más tagállamba irányuló áfamentes termékértékesítés (Áfa tv. 89. §)" |
| 42 |
}, |
| 43 |
{ |
| 44 |
value: "NAM_1", |
| 45 |
text: "Áfamentes közvetítői tevékenység (Áfa tv. 110. §)" |
| 46 |
}, |
| 47 |
{ |
| 48 |
value: "NAM_2", |
| 49 |
text: "Termékek nemzetközi forgalmához kapcsolódó áfamentes ügylet (Áfa tv. 111-118. §)" |
| 50 |
}, |
| 51 |
{ |
| 52 |
value: "SECOND_HAND", |
| 53 |
text: "Különbözet szerinti szabályozás - használt cikkek" |
| 54 |
}, |
| 55 |
{ |
| 56 |
value: "TAM", |
| 57 |
text: "Tevékenység közérdekű jellegére vagy egyéb sajátos jellegére tekintettel áfamentes (Áfa tv. 85-87.§)" |
| 58 |
}, |
| 59 |
{ |
| 60 |
value: "TRAVEL_AGENCY", |
| 61 |
text: "Különbözet szerinti szabályozás - utazási irodák" |
| 62 |
} |
| 63 |
]; |
| 64 |
|
| 65 |
let taxEntitlements = { |
| 66 |
"AAM": ["AAM"], |
| 67 |
"TAM": ["TAM"], |
| 68 |
"EU": ["KBAET"], |
| 69 |
"EUK": ["EAM"], |
| 70 |
"ÁKK": ["ATK"], |
| 71 |
"0%": ["AAM", "EAM", "KBAET", "NAM_1", "NAM_2", "TAM"], |
| 72 |
"AM": ["AAM", "EAM", "KBAET", "NAM_1", "NAM_2", "TAM"], |
| 73 |
"MAA": ["AAM", "EAM", "KBAET", "NAM_1", "NAM_2", "TAM"], |
| 74 |
"ÁTHK": ["EUE", "EUFAD37", "EUFADE", "HO"], |
| 75 |
"K.AFA": ["ANTIQUES", "ARTWORK", "SECOND_HAND", "TRAVEL_AGENCY"], |
| 76 |
}; |
| 77 |
|
| 78 |
function updateTaxOverrideFields() { |
| 79 |
let selectedTaxOverride = $("#wc_billingo_tax_override").val(); |
| 80 |
|
| 81 |
if (selectedTaxOverride === '0') { |
| 82 |
$("input[name='wc_billingo_tax_override_choice']").prop("disabled", true); |
| 83 |
$("#wc_billingo_tax_override_entitlements").prop("disabled", true); |
| 84 |
$("#wc_billingo_tax_override_value").prop("disabled", true); |
| 85 |
$("#wc_billingo_tax_override_zero_entitlements").prop("disabled", true); |
| 86 |
} else { |
| 87 |
$("input[name='wc_billingo_tax_override_choice']").prop("disabled", false); |
| 88 |
$("input[name='wc_billingo_tax_override_choice']:checked").trigger("change"); |
| 89 |
} |
| 90 |
} |
| 91 |
|
| 92 |
updateTaxOverrideFields(); |
| 93 |
|
| 94 |
jQuery("#wc_billingo_tax_override").change(function (e) { |
| 95 |
updateTaxOverrideFields(); |
| 96 |
}); |
| 97 |
|
| 98 |
jQuery("#wc_billingo_generate").click(function (e) { |
| 99 |
e.preventDefault(); |
| 100 |
let r = confirm("Biztosan létrehozod a számlát?"); |
| 101 |
if (r != true) { |
| 102 |
return false; |
| 103 |
} |
| 104 |
let nonce = jQuery(this).data("nonce"); |
| 105 |
let order = jQuery(this).data("order"); |
| 106 |
let button = jQuery("#wc_billingo_generate"); |
| 107 |
let note = jQuery("#wc_billingo_invoice_note").val(); |
| 108 |
let deadline = jQuery("#wc_billingo_invoice_deadline").val(); |
| 109 |
let ignore_proforma = jQuery("#wc_billingo_ignore_proforma").val(); |
| 110 |
let completed = jQuery("#wc_billingo_invoice_completed").val(); |
| 111 |
let invoice_type = jQuery("#wc_billingo_invoice_type").val(); |
| 112 |
|
| 113 |
let data = { |
| 114 |
action: "wc_billingo_generate_invoice", |
| 115 |
nonce: nonce, |
| 116 |
order: order, |
| 117 |
wc_billingo_invoice_note: note, |
| 118 |
wc_billingo_invoice_deadline: deadline, |
| 119 |
wc_billingo_invoice_completed: completed, |
| 120 |
wc_billingo_invoice_type: invoice_type, |
| 121 |
ignore_proforma: ignore_proforma |
| 122 |
}; |
| 123 |
|
| 124 |
button.block({ |
| 125 |
message: null, |
| 126 |
overlayCSS: { |
| 127 |
background: "#fff url(" + wc_billingo_params.loading + ") no-repeat center", |
| 128 |
backgroundSize: "16px 16px", |
| 129 |
opacity: 0.6 |
| 130 |
} |
| 131 |
}); |
| 132 |
|
| 133 |
jQuery.post(ajaxurl, data, function (response) { |
| 134 |
//Remove old messages |
| 135 |
jQuery(".wc-billingo-message").remove(); |
| 136 |
|
| 137 |
//Generate the error/success messages |
| 138 |
if (response.data.error) { |
| 139 |
button.before('<div class="wc-billingo-error error wc-billingo-message"></div>'); |
| 140 |
} else { |
| 141 |
button.before('<div class="wc-billingo-success updated wc-billingo-message"></div>'); |
| 142 |
} |
| 143 |
|
| 144 |
//Get the error messages |
| 145 |
let ul = jQuery("<ul>"); |
| 146 |
jQuery.each(response.data.messages, function (i, value) { |
| 147 |
let li = jQuery("<li>"); |
| 148 |
li.append(value); |
| 149 |
ul.append(li); |
| 150 |
}); |
| 151 |
jQuery(".wc-billingo-message").append(ul); |
| 152 |
|
| 153 |
//If success, hide the button |
| 154 |
if (!response.data.error) { |
| 155 |
button.slideUp(); |
| 156 |
button.before(response.data.link); |
| 157 |
} |
| 158 |
|
| 159 |
button.unblock(); |
| 160 |
}); |
| 161 |
}); |
| 162 |
|
| 163 |
jQuery("#wc_billingo_options").click(function () { |
| 164 |
jQuery("#wc_billingo_options_form").slideToggle(); |
| 165 |
return false; |
| 166 |
}); |
| 167 |
|
| 168 |
jQuery("#wc_billingo_already").click(function (e) { |
| 169 |
e.preventDefault(); |
| 170 |
let note = prompt("Számlakészítés kikapcsolása. Mi az indok?", "Ehhez a rendeléshez nem kell számla."); |
| 171 |
if (!note) { |
| 172 |
return false; |
| 173 |
} |
| 174 |
|
| 175 |
let nonce = jQuery(this).data("nonce"); |
| 176 |
let order = jQuery(this).data("order"); |
| 177 |
let button = jQuery("#wc_billingo_already"); |
| 178 |
|
| 179 |
let data = { |
| 180 |
action: "wc_billingo_already", |
| 181 |
nonce: nonce, |
| 182 |
order: order, |
| 183 |
note: note |
| 184 |
}; |
| 185 |
|
| 186 |
button.block({ |
| 187 |
message: null, |
| 188 |
overlayCSS: { |
| 189 |
background: "#fff url(" + wc_billingo_params.loading + ") no-repeat center", |
| 190 |
backgroundSize: "16px 16px", |
| 191 |
opacity: 0.6 |
| 192 |
} |
| 193 |
}); |
| 194 |
|
| 195 |
jQuery.post(ajaxurl, data, function (response) { |
| 196 |
//Remove old messages |
| 197 |
jQuery(".wc-billingo-message").remove(); |
| 198 |
|
| 199 |
//Generate the error/success messages |
| 200 |
if (response.data.error) { |
| 201 |
button.before('<div class="wc-billingo-error error wc-billingo-message"></div>'); |
| 202 |
} else { |
| 203 |
button.before('<div class="wc-billingo-success updated wc-billingo-message"></div>'); |
| 204 |
} |
| 205 |
|
| 206 |
//Get the error messages |
| 207 |
let ul = jQuery("<ul>"); |
| 208 |
jQuery.each(response.data.messages, function (i, value) { |
| 209 |
let li = jQuery("<li>"); |
| 210 |
li.append(value); |
| 211 |
ul.append(li); |
| 212 |
}); |
| 213 |
jQuery(".wc-billingo-message").append(ul); |
| 214 |
|
| 215 |
//If success, hide the button |
| 216 |
if (!response.data.error) { |
| 217 |
button.slideUp(); |
| 218 |
button.before(response.data.link); |
| 219 |
} |
| 220 |
|
| 221 |
button.unblock(); |
| 222 |
}); |
| 223 |
}); |
| 224 |
|
| 225 |
jQuery("#wc_billingo_already_back").click(function (e) { |
| 226 |
e.preventDefault(); |
| 227 |
let r = confirm("Biztosan visszakapcsolod a számlakészítés ennél a rendelésnél?"); |
| 228 |
if (r != true) { |
| 229 |
return false; |
| 230 |
} |
| 231 |
|
| 232 |
let nonce = jQuery(this).data("nonce"); |
| 233 |
let order = jQuery(this).data("order"); |
| 234 |
let button = jQuery("#wc_billingo_already_back"); |
| 235 |
|
| 236 |
let data = { |
| 237 |
action: "wc_billingo_already_back", |
| 238 |
nonce: nonce, |
| 239 |
order: order |
| 240 |
}; |
| 241 |
|
| 242 |
jQuery("#billingo_already_div").block({ |
| 243 |
message: null, |
| 244 |
overlayCSS: { |
| 245 |
background: "#fff url(" + wc_billingo_params.loading + ") no-repeat center", |
| 246 |
backgroundSize: "16px 16px", |
| 247 |
opacity: 0.6 |
| 248 |
} |
| 249 |
}); |
| 250 |
|
| 251 |
jQuery.post(ajaxurl, data, function (response) { |
| 252 |
//Remove old messages |
| 253 |
jQuery(".wc-billingo-message").remove(); |
| 254 |
|
| 255 |
//Generate the error/success messages |
| 256 |
if (response.data.error) { |
| 257 |
button.before('<div class="wc-billingo-error error wc-billingo-message"></div>'); |
| 258 |
} else { |
| 259 |
button.before('<div class="wc-billingo-success updated wc-billingo-message"></div>'); |
| 260 |
} |
| 261 |
|
| 262 |
//Get the error messages |
| 263 |
let ul = jQuery("<ul>"); |
| 264 |
jQuery.each(response.data.messages, function (i, value) { |
| 265 |
let li = jQuery("<li>"); |
| 266 |
li.append(value); |
| 267 |
ul.append(li); |
| 268 |
}); |
| 269 |
jQuery(".wc-billingo-message").append(ul); |
| 270 |
|
| 271 |
//If success, show the button |
| 272 |
if (!response.data.error) { |
| 273 |
button.slideDown(); |
| 274 |
} |
| 275 |
|
| 276 |
jQuery("#billingo_already_div").unblock().slideUp(); |
| 277 |
}); |
| 278 |
}); |
| 279 |
|
| 280 |
|
| 281 |
jQuery("#wc_billingo_storno").click(function (e) { |
| 282 |
e.preventDefault(); |
| 283 |
let r = confirm("Biztosan sztornózod a számlát?"); |
| 284 |
if (r != true) { |
| 285 |
return false; |
| 286 |
} |
| 287 |
let nonce = jQuery(this).data("nonce"); |
| 288 |
let order = jQuery(this).data("order"); |
| 289 |
let button = jQuery("#wc_billingo_storno"); |
| 290 |
|
| 291 |
let data = { |
| 292 |
action: "wc_billingo_storno_invoice", |
| 293 |
nonce: nonce, |
| 294 |
order: order |
| 295 |
}; |
| 296 |
|
| 297 |
button.block({ |
| 298 |
message: null, |
| 299 |
overlayCSS: { |
| 300 |
background: "#fff url(" + wc_billingo_params.loading + ") no-repeat center", |
| 301 |
backgroundSize: "16px 16px", |
| 302 |
opacity: 0.6 |
| 303 |
} |
| 304 |
}); |
| 305 |
|
| 306 |
jQuery.post(ajaxurl, data, function (response) { |
| 307 |
//Remove old messages |
| 308 |
jQuery(".wc-billingo-message").remove(); |
| 309 |
|
| 310 |
//Generate the error/success messages |
| 311 |
if (response.data.error) { |
| 312 |
button.before('<div class="wc-billingo-error error wc-billingo-message"></div>'); |
| 313 |
} else { |
| 314 |
button.before('<div class="wc-billingo-success updated wc-billingo-message"></div>'); |
| 315 |
} |
| 316 |
|
| 317 |
//Get the error messages |
| 318 |
let ul = jQuery("<ul>"); |
| 319 |
jQuery.each(response.data.messages, function (i, value) { |
| 320 |
let li = jQuery("<li>"); |
| 321 |
li.append(value); |
| 322 |
ul.append(li); |
| 323 |
}); |
| 324 |
jQuery(".wc-billingo-message").append(ul); |
| 325 |
|
| 326 |
//If success, hide the button |
| 327 |
if (!response.data.error) { |
| 328 |
button.slideUp(); |
| 329 |
} |
| 330 |
|
| 331 |
button.unblock(); |
| 332 |
}); |
| 333 |
}); |
| 334 |
|
| 335 |
function updateTaxOverrideFields() { |
| 336 |
let selectedTaxOverride = $("#wc_billingo_tax_override").val(); |
| 337 |
|
| 338 |
if (selectedTaxOverride === '0') { |
| 339 |
$("[name='wc_billingo_tax_override_choice']").prop("disabled", true); |
| 340 |
$("#wc_billingo_tax_override_entitlements").prop("disabled", true); |
| 341 |
$("#wc_billingo_tax_override_value").prop("disabled", true); |
| 342 |
$("#wc_billingo_tax_override_zero_entitlements").prop("disabled", true); |
| 343 |
} else { |
| 344 |
$("[name='wc_billingo_tax_override_choice']").prop("disabled", false); |
| 345 |
$("[name='wc_billingo_tax_override_choice']").trigger("change"); |
| 346 |
} |
| 347 |
} |
| 348 |
|
| 349 |
function updateTaxOverrideChoiceFields() { |
| 350 |
let selectedChoice = $("[name='wc_billingo_tax_override_choice']").val(); |
| 351 |
|
| 352 |
if (selectedChoice === '0') { |
| 353 |
$("#wc_billingo_tax_override_entitlements").prop("disabled", true); |
| 354 |
$("#wc_billingo_tax_override_value").prop("disabled", true); |
| 355 |
$("#wc_billingo_tax_override_zero_entitlements").prop("disabled", false); |
| 356 |
} else { |
| 357 |
$("#wc_billingo_tax_override_entitlements").prop("disabled", false); |
| 358 |
$("#wc_billingo_tax_override_value").prop("disabled", false); |
| 359 |
$("#wc_billingo_tax_override_zero_entitlements").prop("disabled", true); |
| 360 |
//remove 0% option from the entitlements select in wc_billingo_tax_override_value |
| 361 |
$("#wc_billingo_tax_override_value").find("option[value='0%']").remove(); |
| 362 |
} |
| 363 |
} |
| 364 |
|
| 365 |
updateTaxOverrideFields(); |
| 366 |
updateTaxOverrideChoiceFields(); |
| 367 |
|
| 368 |
$("#wc_billingo_tax_override").change(function (e) { |
| 369 |
updateTaxOverrideFields(); |
| 370 |
}).trigger('change'); |
| 371 |
|
| 372 |
$("[name='wc_billingo_tax_override_choice']").change(function (e) { |
| 373 |
updateTaxOverrideChoiceFields(); |
| 374 |
}); |
| 375 |
|
| 376 |
|
| 377 |
function handleBillingoEmailSettings(selectName, inputNames) { |
| 378 |
$('select[name="' + selectName + '"]').change(function() { |
| 379 |
var selected = $(this).val(); |
| 380 |
var inputs = inputNames.map(function(name) { |
| 381 |
return 'input[name="' + name + '"]'; |
| 382 |
}).join(','); |
| 383 |
|
| 384 |
if (selected === 'no' || selected === 'billingo') { |
| 385 |
$(inputs).prop('disabled', true); |
| 386 |
} else { |
| 387 |
$(inputs).prop('disabled', false); |
| 388 |
} |
| 389 |
}).trigger('change'); |
| 390 |
} |
| 391 |
|
| 392 |
handleBillingoEmailSettings('billingo_email_settings[wc_billingo_proforma_email]', [ |
| 393 |
'billingo_email_settings[wc_billingo_proforma_email_woo_btn]', |
| 394 |
'billingo_email_settings[wc_billingo_proforma_email_woo_text]' |
| 395 |
]); |
| 396 |
|
| 397 |
handleBillingoEmailSettings('billingo_email_settings[wc_billingo_email]', [ |
| 398 |
'billingo_email_settings[wc_billingo_email_woo_btn]', |
| 399 |
'billingo_email_settings[wc_billingo_email_woo_text]' |
| 400 |
]); |
| 401 |
|
| 402 |
handleBillingoEmailSettings('billingo_email_settings[wc_billingo_storno_email]', [ |
| 403 |
'billingo_email_settings[wc_billingo_storno_email_woo_btn]', |
| 404 |
'billingo_email_settings[wc_billingo_storno_email_woo_text]' |
| 405 |
]); |
| 406 |
|
| 407 |
function dataEraserHandler() { |
| 408 |
let state = $('#wc_billingo_data_eraser_code').is(':checked'); |
| 409 |
|
| 410 |
$("#wc_billingo_data_eraser_code_selector").prop("disabled", !state); |
| 411 |
} |
| 412 |
|
| 413 |
$('#wc_billingo_data_eraser_code').change(dataEraserHandler); |
| 414 |
|
| 415 |
dataEraserHandler(); |
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
// add billingo logo int the woocommerce settings page to the main navigation |
| 421 |
function addBillingoLogoToMainNav() { |
| 422 |
const billingoLogoSvgElementDiv = document.createElement('div'); |
| 423 |
billingoLogoSvgElementDiv.id = 'billingo-logo-to-main-nav'; |
| 424 |
billingoLogoSvgElementDiv.style.display = 'none'; |
| 425 |
|
| 426 |
billingoLogoSvgElementDiv.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="94" height="24" viewBox="0 0 302 96" fill="none"> |
| 427 |
<path fill-rule="evenodd" clip-rule="evenodd" d="M86.1567 41.7349C86.2534 41.2203 86.3561 40.7571 86.4562 40.3571L93.4029 12.0741C95.3877 4.46575 99.8534 0 107.958 0C114.243 0 119.04 4.13495 119.04 9.92388C119.04 14.7204 117.055 19.1862 112.424 24.1481L95.1503 43.0357C93.569 50.6624 97.3863 53.0928 101.507 53.0928C109.524 53.0928 114.554 46.6674 116.595 41.2023C116.684 40.9077 116.782 40.6254 116.889 40.3571L124.002 12.0741C125.986 4.46575 130.452 0 138.557 0C144.842 0 149.638 4.13495 149.638 9.92388C149.638 14.7204 147.653 19.1862 143.022 24.1481L125.753 43.0321C124.21 50.6616 128.55 53.0928 134.256 53.0928C139.848 53.0928 145.303 50.0544 147.842 42.0845L152.119 24.9751H162.043L157.081 44.6575C155.758 49.9502 157.247 53.0928 161.382 53.0928C166.343 53.0928 168.328 51.6042 170.313 43.6651L172.629 34.072C174.448 26.4637 179.079 24.3135 186.522 24.3135H196.28C203.062 24.3135 208.189 29.937 206.535 36.7184L200.25 62.0243H190.326L196.611 37.0492C197.273 34.5682 196.28 33.245 193.8 33.245H186.191C184.206 33.245 183.049 34.2374 182.552 36.0568L179.244 49.7848C177.425 57.0623 172.132 62.0243 163.532 62.0243H161.382C156.297 62.0243 152.033 59.6601 149.565 55.3371C146.267 58.9457 141.282 62.0243 133.429 62.0243C125.502 62.0243 120.753 58.496 118.264 54.1052C114.503 58.3099 109.066 62.0243 101.507 62.0243C94.4648 62.0243 90.4209 59.5708 88.1863 56.2562C85.1004 59.6023 80.7126 62.0243 74.3821 62.0243C67.4354 62.0243 57.3461 58.5509 61.4811 42.1765L65.7814 24.9751H75.7053L70.9088 43.1689C69.0894 49.9502 71.7358 53.0928 76.5323 53.0928C82.6279 53.0928 85.1153 46.1436 86.1567 41.7349ZM129.433 28.139L135.745 19.517C139.384 14.555 140.541 13.0664 140.541 11.5779C140.541 10.0893 139.218 8.9315 137.73 8.9315C135.579 8.9315 133.925 10.2547 132.933 14.0588L129.433 28.139ZM98.8352 28.139L105.146 19.517C108.785 14.555 109.943 13.0664 109.943 11.5779C109.943 10.0893 108.62 8.9315 107.131 8.9315C104.981 8.9315 103.327 10.2547 102.334 14.0588L98.8352 28.139ZM46.7277 30.9273C52.642 33.5528 54.0382 37.871 54.0382 43.0035C54.0382 53.589 45.2721 62.6859 29.7247 62.6859H21.7855C6.89972 62.6859 -3.52036 55.0776 1.11079 37.0492L6.89972 13.728C10.2077 1.98478 11.6963 0.496194 26.4167 0.496194H38.4907C49.0762 0.496194 57.1807 5.12734 57.1807 15.8782C57.1807 21.2037 54.5684 27.3603 46.7277 30.9273ZM34.1904 35.0644H22.7779L25.0935 26.1329H33.8596C42.9565 26.1329 46.9261 22.9903 46.9261 16.8706C46.9261 11.2471 43.6181 9.42769 36.1752 9.42769H25.5897C18.4776 9.42769 17.9814 9.75848 16.3274 16.3744L10.7039 38.207C8.3883 47.6346 12.5233 53.7544 23.6049 53.7544H29.5593C39.8139 53.7544 43.7835 48.7924 43.7835 43.1689C43.7835 37.5454 41.7987 35.0644 34.1904 35.0644ZM235.543 60.8531C232.971 61.9894 229.729 62.8513 225.225 62.8513C216.128 62.8513 208.189 54.5814 210.505 42.6727C212.655 31.9218 221.421 24.3135 232.668 24.3135C244.411 24.3135 251.689 33.245 248.877 44.1613L238.788 83.1952C236.307 92.1267 231.51 95.7655 224.398 95.7655C215.467 95.7655 210.836 89.3149 212.655 81.7066C214.997 72.9266 224.458 68.4191 235.543 60.8531ZM227.21 53.7544C233.495 53.7544 237.299 50.281 238.788 43.0035C239.78 37.38 236.803 33.5758 231.345 33.5758C225.225 33.5758 221.752 37.7108 220.759 43.0035C219.271 49.2886 222.413 53.7544 227.21 53.7544ZM233.034 71.2227C227.319 76.9686 223.712 80.1289 222.91 82.5336C222.083 84.8492 223.737 86.6686 225.391 86.6686C227.21 86.6686 228.699 85.3454 230.022 81.3758L233.034 71.2227ZM287.243 28.4485H301.804V36.3876H291.538C292.026 38.767 292.046 41.3919 291.55 44.1613C289.73 55.4083 280.799 62.8513 269.056 62.8513C257.312 62.8513 250.696 54.9122 253.177 42.6727C255.328 32.2526 264.424 24.3135 275.837 24.3135C280.614 24.3135 284.494 25.8496 287.243 28.4485ZM269.883 53.7544C275.341 53.7544 279.972 51.4388 281.46 43.0035C282.453 37.38 279.972 33.5758 274.183 33.5758C268.229 33.5758 264.424 37.7108 263.267 43.0035C261.944 49.2886 265.086 53.7544 269.883 53.7544ZM73.5551 19.1862C69.5856 19.1862 66.443 16.0436 66.443 12.0741C66.443 8.1045 69.5856 4.96194 73.5551 4.96194C77.5247 4.96194 80.6673 8.1045 80.6673 12.0741C80.6673 16.0436 77.5247 19.1862 73.5551 19.1862ZM159.893 19.1862C155.923 19.1862 152.781 16.0436 152.781 12.0741C152.781 8.1045 155.923 4.96194 159.893 4.96194C163.862 4.96194 167.005 8.1045 167.005 12.0741C167.005 16.0436 163.862 19.1862 159.893 19.1862Z" fill="#EFF3F5"/> |
| 428 |
</svg>`; |
| 429 |
|
| 430 |
document.body.appendChild(billingoLogoSvgElementDiv); |
| 431 |
|
| 432 |
const billingoLogoSvgElement = billingoLogoSvgElementDiv.querySelector('svg'); |
| 433 |
if (!billingoLogoSvgElement) return; |
| 434 |
|
| 435 |
const billingoMenuElement = document.querySelector('a[href*="tab=settings_tab_billingo"]'); |
| 436 |
if (!billingoMenuElement) return; |
| 437 |
|
| 438 |
billingoMenuElement.innerHTML = ''; |
| 439 |
billingoMenuElement.appendChild(billingoLogoSvgElement.cloneNode(true)); |
| 440 |
|
| 441 |
// if billingo menu element is active add white background to the element |
| 442 |
if (billingoMenuElement.classList.contains('nav-tab-active')) { |
| 443 |
billingoMenuElement.style.backgroundColor = '#FFF'; |
| 444 |
} |
| 445 |
|
| 446 |
|
| 447 |
} |
| 448 |
addBillingoLogoToMainNav(); |
| 449 |
|
| 450 |
// Handle document icons in orders admin page |
| 451 |
function handleOrderDocumentIcons() { |
| 452 |
// Only run on orders admin page and for screens wider than 370px |
| 453 |
if (window.location.href.indexOf('page=wc-orders') !== -1 && window.innerWidth >= 370) { |
| 454 |
var screenWidth = window.innerWidth; |
| 455 |
|
| 456 |
// Handle different DOM structures for different screen sizes |
| 457 |
if (screenWidth < 782) { |
| 458 |
// Below 782px: Look for icons in ANY column and move to order_number column |
| 459 |
jQuery('tr').each(function() { |
| 460 |
var $row = jQuery(this); |
| 461 |
var $orderNumberColumn = $row.find('.order_number.column-order_number'); |
| 462 |
var $orderStatusColumn = $row.find('.order_status.column-order_status'); |
| 463 |
var $statusMark = $orderNumberColumn.find('.order_status.small-screen-only .order-status'); |
| 464 |
|
| 465 |
// Look for icons in both columns |
| 466 |
var $documentIcons = $orderStatusColumn.find('.billingo-document-icons'); |
| 467 |
if ($documentIcons.length === 0) { |
| 468 |
$documentIcons = $orderNumberColumn.find('.billingo-document-icons'); |
| 469 |
} |
| 470 |
|
| 471 |
if ($documentIcons.length > 0 && $statusMark.length > 0) { |
| 472 |
// Move icons to order_number column, before the mark (if not already there) |
| 473 |
if ($statusMark.prev('.billingo-document-icons').length === 0) { |
| 474 |
$documentIcons.detach(); |
| 475 |
$statusMark.before($documentIcons); |
| 476 |
} |
| 477 |
|
| 478 |
// Style for small screens |
| 479 |
$documentIcons.css({ |
| 480 |
'margin-left': '0', |
| 481 |
'margin-right': '5px', |
| 482 |
'display': 'inline-block', |
| 483 |
'vertical-align': 'middle' |
| 484 |
}); |
| 485 |
|
| 486 |
// Style the status mark to ensure proper alignment |
| 487 |
$statusMark.css({ |
| 488 |
'display': 'inline-block', |
| 489 |
'vertical-align': 'middle' |
| 490 |
}); |
| 491 |
|
| 492 |
// Show medium screen version only |
| 493 |
$documentIcons.find('.billingo-docs-large-screen').css('display', 'none'); |
| 494 |
$documentIcons.find('.billingo-docs-medium-screen').css('display', 'inline-block'); |
| 495 |
} |
| 496 |
}); |
| 497 |
} else { |
| 498 |
// Above 782px: Move icons back to order_status column |
| 499 |
jQuery('tr').each(function() { |
| 500 |
var $row = jQuery(this); |
| 501 |
var $orderNumberColumn = $row.find('.order_number.column-order_number'); |
| 502 |
var $orderStatusColumn = $row.find('.order_status.column-order_status'); |
| 503 |
var $statusMark = $orderStatusColumn.find('.order-status'); |
| 504 |
|
| 505 |
// Look for icons in both columns |
| 506 |
var $documentIcons = $orderNumberColumn.find('.billingo-document-icons'); |
| 507 |
if ($documentIcons.length === 0) { |
| 508 |
$documentIcons = $orderStatusColumn.find('.billingo-document-icons'); |
| 509 |
} |
| 510 |
|
| 511 |
if ($documentIcons.length > 0 && $statusMark.length > 0) { |
| 512 |
// Move icons to order_status column, after the mark (if not already there) |
| 513 |
if ($statusMark.next('.billingo-document-icons').length === 0) { |
| 514 |
$documentIcons.detach(); |
| 515 |
$statusMark.after($documentIcons); |
| 516 |
} |
| 517 |
|
| 518 |
// Style for large screens |
| 519 |
$documentIcons.css({ |
| 520 |
'margin-left': '5px', |
| 521 |
'margin-right': '0', |
| 522 |
'display': 'inline-block', |
| 523 |
'vertical-align': 'middle' |
| 524 |
}); |
| 525 |
|
| 526 |
// Style the status mark to ensure proper alignment |
| 527 |
$statusMark.css({ |
| 528 |
'display': 'inline-block', |
| 529 |
'vertical-align': 'middle' |
| 530 |
}); |
| 531 |
|
| 532 |
// Handle responsive display for large vs medium screens |
| 533 |
if (screenWidth >= 1300) { |
| 534 |
// Large screens: show large screen version, hide medium screen version |
| 535 |
$documentIcons.find('.billingo-docs-large-screen').css('display', 'inline-block'); |
| 536 |
$documentIcons.find('.billingo-docs-medium-screen').css('display', 'none'); |
| 537 |
} else { |
| 538 |
// Medium screens: show medium screen version, hide large screen version |
| 539 |
$documentIcons.find('.billingo-docs-large-screen').css('display', 'none'); |
| 540 |
$documentIcons.find('.billingo-docs-medium-screen').css('display', 'inline-block'); |
| 541 |
} |
| 542 |
} |
| 543 |
}); |
| 544 |
} |
| 545 |
} else if (window.innerWidth < 370) { |
| 546 |
// Hide document icons on very small screens |
| 547 |
jQuery('.billingo-document-icons').hide(); |
| 548 |
} |
| 549 |
} |
| 550 |
|
| 551 |
// Run on page load |
| 552 |
handleOrderDocumentIcons(); |
| 553 |
|
| 554 |
// Run when screen is resized |
| 555 |
jQuery(window).on('resize', function() { |
| 556 |
handleOrderDocumentIcons(); |
| 557 |
}); |
| 558 |
}); |
| 559 |
|