Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="es">
    <noscript class="" style="display:none;">
      <?php
    $debug = 0;
    $seguir = 0;
    //$datos = array_merge($datos,$usr_info->
    $session = session();
    $usr_info = $session->get('usr_info');
    //dd($session->get('lang'));
    //dd($usr_info);


    if(isset($error)){
        echo '<script> alert(\''.$error.'\')</script>';
    }
    ?></noscript>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title><?=$titulo;?></title>

  <noscript class="" style="display:none;">@include('dashboard.includes.headerdashboardlinks')</noscript>

</head>

<body class="fixed-nav sticky-footer" id="page-top">

  <noscript class="" style="display:none;">@include('dashboard.includes.headerdashboardmenu')</noscript>

    <div class="content-wrapper">
        <div class="container-fluid">
            <!-- Breadcrumbs-->
            <!--<ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="/dashboard#">{{trans('trad.panel-dash') }}</a>
                </li>
                <li class="breadcrumb-item active">{{trans('trad.cambioclave-dash') }}</li>
            </ol>-->

            <!-- /box_general-->
            <div class="row">
                <div class="col-md-12">
                    <div class="box_general padding_bottom">
                        <div class="container">
                            <div id="calendar" class="calendar">
                                <div class="calendar-title">
                                  <div class="calendar-title-text"></div>
                                  <div class="calendar-button-group">
                                    <button id="prevMonth">&lt;</button>
                                    <button id="today">Hoy</button>
                                    <button id="nextMonth">&gt;</button>
                                  </div>
                                </div>
                                <div class="calendar-day-name"></div>
                                <div class="calendar-dates"></div>
                            </div>
                            <!-- calendar-left -->
                          <!-- container -->
                    </div>
                </div>
            </div>

            <!-- /row-->


        </div>
        <script type="text/javascript" src="https://unpkg.com/[email protected]/dayjs.min.js"></script>
        <script>
/*
                                                 
 _____ _____ __    _____ _____ ____  _____ _____ 
|     |  _  |  |  |   __|   | |    \|  _  | __  |
|   --|     |  |__|   __| | | |  |  |     |    -|
|_____|__|__|_____|_____|_|___|____/|__|__|__|__|
                                                 
                                                 
 _____ _____ _____ __    ____  _____ _____       
| __  |  |  |     |  |  |    \|   __| __  |      
| __ -|  |  |-   -|  |__|  |  |   __|    -|      
|_____|_____|_____|_____|____/|_____|__|__|      
                                                 
*/
let currentDate = dayjs(),
    daysInMonth = dayjs().daysInMonth(),
    firstDayPosition = dayjs().startOf("month").day(),
    monthNames = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
    weekNames = ["Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Dom"],
    dateElement = document.querySelector("#calendar .calendar-dates"),
    calendarTitle = document.querySelector(".calendar-title-text"),
    nextMonthButton = document.querySelector("#nextMonth"),
    prevMonthButton = document.querySelector("#prevMonth"),
    dayNamesElement = document.querySelector(".calendar-day-name"),
    todayButton = document.querySelector("#today"),
    dateItems = null,
    newMonth = null;

function plotDays() {
    let t = 1;
    dateElement.innerHTML = "";
    let e = currentDate.subtract(1, "month").endOf("month").$D,
        n = [];
    for (let a = 1; a < firstDayPosition; a++) n.push(e--);
    n.reverse().forEach(function(t) {
        dateElement.innerHTML += `<button class="calendar-dates-day-empty">${t}</button>`
    });
    for (let r = 0; r < daysInMonth; r++) dateElement.innerHTML += `
        <button class="calendar-dates-day">
            ${t++}
            <div class="date-marker">
                `+`
                <noscript class="" style="display:none;"><?php
                echo '<div class="ball" style="background: red;"></div>';
                echo '<div class="ball" style="background: blue;"></div>';
                echo '<div class="ball" style="background: orange;"></div>';
                ?></noscript>`+
            `
<div class="ball" style="background: purple;"></div>
</div>
        </button>`;

    let o = 42 - Number(document.querySelector(".calendar-dates").children.length),
        d = 1;
    for (let l = 0; l < o; l++) document.querySelector(".calendar-dates").innerHTML += `<button class="calendar-dates-day-empty">${d++}</button>`;
    calendarTitle.innerHTML = `${monthNames[currentDate.month()]} - ${currentDate.year()}`
}

function highlightCurrentDate() {
    dateItems = document.querySelectorAll(".calendar-dates-day"), dateElement && dateItems[currentDate.$D - 1] && dateItems[currentDate.$D - 1].classList.add("today-date")
}

function setSelectedMonth() {
    daysInMonth = newMonth.daysInMonth(), firstDayPosition = newMonth.startOf("month").day(), currentDate = newMonth, plotDays()
}
weekNames.forEach(function(t) {
    dayNamesElement.innerHTML += `<div>${t}</div>`
}), nextMonthButton.addEventListener("click", function() {
    newMonth = currentDate.add(1, "month").startOf("month"), setSelectedMonth()
}), prevMonthButton.addEventListener("click", function() {
    newMonth = currentDate.subtract(1, "month").startOf("month"), setSelectedMonth()
}), todayButton.addEventListener("click", function() {
    newMonth = dayjs(), setSelectedMonth(), setTimeout(function() {
        highlightCurrentDate()
    }, 50)
}), plotDays(), setTimeout(function() {
    highlightCurrentDate()
}, 50);
        </script>
        <!-- /.container-fluid-->


        <noscript class="" style="display:none;">
          @include('dashboard.includes.dashboardfooter')
        <?php
            echo '<div class="ball" style="background: red;"></div>';
            echo '<div class="ball" style="background: blue;"></div>';
            echo '<div class="ball" style="background: orange;"></div>';
        ?>
        <noscript>

</body>
</html>


              
            
!

CSS

              
                .ball{width: 5pt;height: 5pt;border-radius: 100%;/* border: solid 1pt white; */margin-right: 1px;}
           .date-marker {width: 0; height: 3pt;/* margin: auto; */ bottom: 0pt;display: -webkit-box;position: relative;}
           /* {position: relative;width: 0;height: 5px;margin: auto;bottom: 5px;display: inline-block;} */
           @import url(https://fonts.googleapis.com/css2?family=Manrope:wght@200;300;400;500;600&display=swap);.calendar{max-width:300px;margin:30px auto;padding:20px;box-sizing:border-box;background:#fff;border-radius:12px;box-shadow:0 0 3px #dadada}.calendar .calendar-dates,.calendar .calendar-day-name{display:grid;grid-template-columns:repeat(7,1fr);grid-gap:8px}.calendar .calendar-dates-day{font-family:Manrope,sans-serif;font-size:13px;border:1px solid #efefef;padding:4px;box-sizing:border-box;background:#f8f8f8;border-radius:4px;color:#333}.calendar .calendar-dates-day-empty{background:0 0;border:0;color:#dcdcdc;min-height:28px}.calendar .calendar-day-name div{text-align:center;margin-bottom:12px;font-size:13px;font-weight:700}.calendar .calendar-title{padding-bottom:16px;text-align:center;font-weight:500;display:flex;justify-content:space-between;border-bottom:1px solid #ddd;margin-bottom:12px}.calendar .calendar-dates-day.today-date{background:#555;color:#fff}.calendar #nextMonth,.calendar #prevMonth,.calendar #today{padding:2px 6px;box-sizing:border-box;font-family:Manrope,sans-serif;font-size:20px;line-height:20px;border:1px solid #e0e0e0;border-radius:4px;cursor:pointer;color:#333}.calendar #today{font-size:13px}.calendar .calendar-title-text{display:flex;align-items:center;font-size:14px;font-weight:700}.calendar .calendar-button-group{display:flex;align-items:center;gap:8px}
              
            
!

JS

              
                 
/*                                                             
 _____             _      __    _     _                       
|   __|_ _ ___ ___| |_   |  |  |_|___| |_ ___ ___ ___ ___ ___ 
|   __| | | -_|   |  _|  |  |__| |_ -|  _| -_|   | -_|  _|_ -|
|_____|\_/|___|_|_|_|    |_____|_|___|_| |___|_|_|___|_| |___|
                                                                                                                           
 ____             _          ____                             
|    \ ___ _ _   | |_ _ _   |    \ ___ _ _                    
|  |  | .'| | |  | . | | |  |  |  | .'| | |                   
|____/|__,|_  |  |___|_  |  |____/|__,|_  |                   
          |___|      |___|            |___|                   
*/

// Obtener todos los botones con la clase "calendar-dates-day"
var buttons = document.querySelectorAll('.calendar-dates-day');

// Obtener el elemento con la clase "calendar-title-text"
var titleElement = document.querySelector('.calendar-title-text');

// Función que se encarga de agregar el listener a los botones
function addListeners() {
  // Obtener el texto del elemento "calendar-title-text"
  var titleText = titleElement.innerText;

  // Dividir el texto en el primer guión y obtener el mes y el año
  var [monthText, yearText] = titleText.split('-');

  // Traducir el mes de texto a número
  const months = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];
  const monthIndex = months.findIndex((month) => month.toLowerCase() === monthText.trim().toLowerCase());
  const month = monthIndex + 1;

  // Iterar sobre todos los botones y agregar un listener de clic
  buttons.forEach((button) => {
    button.addEventListener('click', () => {
      console.log(`Día: ${button.innerText}, Mes: ${month}, Año: ${yearText.trim()}`);
    });
  });
}

// Función que se encarga de remover el listener a los botones
function removeListeners() {
  buttons.forEach((button) => {
    button.removeEventListener('click', () => {});
  });
}

// Obtener los botones del grupo de botones del calendario
var prevMonthButtonL = document.getElementById('prevMonth');
var HoyButton = document.getElementById('today');
var nextMonthButtonR = document.getElementById('nextMonth');

// Agregar listeners a los botones del grupo de botones del calendario
prevMonthButtonL.addEventListener('click', () => {
  removeListeners();
  setTimeout(() => {
    addListeners();
  }, 1000);
});

HoyButton.addEventListener('click', () => {
  removeListeners();
  setTimeout(() => {
    addListeners();
  }, 1000);
});

nextMonthButtonR.addEventListener('click', () => {
  removeListeners();
  setTimeout(() => {
    addListeners();
  }, 1000);
});

// Agregar el listener inicialmente
addListeners();
              
            
!
999px

Console