Files
oficial/app/resources/views/layout/body/scripts.blade.php
2024-03-26 16:57:07 -03:00

56 lines
2.3 KiB
PHP

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.3/semantic.min.js" integrity="sha512-gnoBksrDbaMnlE0rhhkcx3iwzvgBGz6mOEj4/Y5ZY09n55dYddx6+WYc72A55qEesV8VX2iMomteIwobeGK1BQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script type="text/javascript">
function cleanNoCache() {
const url = new URL(window.location.href)
if (url.searchParams.has('nocache')) {
url.searchParams.delete('nocache')
window.location.href = url.href
}
}
function fetchAPI(url, options=null) {
if (options === null) {
options = {}
}
if (!Object.hasOwn(options, 'headers')) {
options['headers'] = {}
}
if (!Object.hasOwn(options['headers'], 'Authorization')) {
@if (!$login->isIn())
options['headers']['Authorization'] = 'Bearer {{md5($API_KEY)}}'
@else
options['headers']['Authorization'] = 'Bearer {{md5($API_KEY)}}{{$login->getSeparator()}}{{$login->getToken()}}'
@endif
}
return fetch(url, options).then(response => {
if (response.ok) {
return response
}
throw new Error(JSON.stringify({code: response.status, message: response.statusText, url}))
}).catch(error => {
console.error(error)
})
}
const calendar_date_options = {
type: 'date',
firstDayOfWeek: 1,
today: true,
monthFirst: false,
text: {
days: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
monthsShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
today: 'Hoy'
},
formatter: {
date: 'DD-MM-YYYY'
},
}
$(document).ready(() => {
cleanNoCache()
})
</script>
@stack('page_scripts')