Модальный конфликт между макетом css и представлением css с использованием AdminLTE и yii2FullCalendar - PullRequest
0 голосов
/ 19 апреля 2020

Я использую Admin LTE 3.0 и yii2fullcalendar v3.9.0

Я установил боковую панель в моем основном макете с Admin LTE. Теперь я хочу установить yii2fullcalendar со скриптом, который получает дату, по которой я щелкаю в календаре, и показывает модальную форму для создания событий с уже установленной датой.

Проблема в том, что модальное окно не отображается, потому что adminlte . css вызывает неисправность. См. Изображение ниже

Modal doesn't show

Вот код

CalendarioAsset. php

<?php

namespace app\assets;

use yii\web\AssetBundle;

class CalendarioAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
        'css/calendario/site.css',
    ];
    public $js = [
        'js/calendario/createEvent.js',
        'js/jquery.min.js'

    ];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\web\JqueryAsset',
        'yii\bootstrap\BootstrapAsset',          
    ];
}

DashboardAsset. php

<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace app\assets;

use yii\web\AssetBundle;

/**
 * Main application asset bundle.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class DashboardAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
        'css/site.css',
        'css/all.min.css',
        'css/OverlayScrollbars.min.css',
        'css/adminlte.css',
        'https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700'


    ];
    public $js = [
        'js/jquery.min.js',
        'js/bootstrap.bundle.min.js',
        'js/jquery.overlayScrollbars.min.js',
        'js/adminlte.js',
        'js/demo.js',
        'js/jquery.mousewheel.js',
        'js/raphael.min.js',
        'js/jquery.mapael.min.js',
        'js/usa_states.min.js',
        'js/Chart.min.js',
        'js/dashboard2.js'

    ];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\web\JqueryAsset',
        'yii\bootstrap\BootstrapAsset',
    ];
}

просмотр индекса. php

<?php

use yii\helpers\Html;
use yii\bootstrap\Modal;
use app\assets\CalendarioAsset;
use yii\web\JsExpression;

CalendarioAsset::register($this);

/* @var $this yii\web\View */
/* @var $searchModel app\models\CalendarioSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Calendario de Reuniones';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="calendario-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('Ver lista', ['lista'], ['class' => 'btn btn-success']) ?>
        <?= Html::a('Crear Reunión', ['create_lista'], ['class' => 'btn btn-success']) ?>
    </p>

    <p>
        <?php 
            Modal::begin([
                'header' => '<h3>Crear Evento</h3>',
                'id'=>'create',
                'size'=>'modal-lg',
            ]);

            echo "<div id='modalCreate'></div>";
            Modal::end();
        ?>
    </p>

    <p>
        <?php 
            Modal::begin([
                'header' => '<h3>Información del evento</h3>',
                'id'=>'view',
                'size'=>'modal-lg',
            ]);

            echo "<div id='modalView'></div>";
            Modal::end();
        ?>
    </p>

    <p>
        <?php
            Modal::begin([
                'header' => '<h3>Actualizar evento</h3>',
                'id' => 'update',
                'size' => 'modal-lg'
            ]);
            echo "<div id='modalUpdate'></div>";
            Modal::end();
        ?>
    </p>

    <p>
        <?php 
            $JsEventClick = 'function(event) {
                $.get("index.php?r=calendario/view", {"id": event.id}, function(data){
                    $("#view").modal("show")
                           .find("#modalView")
                           .html(data);
               });            
            }'
        ?>
    </p>

    <p>
        <?php
            $JsEventDrop = 'function(event, delta, revertFunc) {
                    var event_data = {
                        id: event.id,
                        fecha_inicio: $.fullCalendar.formatDate(event.start, "YYYY-MM-DD"),
                        hora_inicio: $.fullCalendar.formatDate(event.start, "HH:mm"),
                        hora_termino: $.fullCalendar.formatDate(event.end, "HH:mm"),
                        fecha_termino: $.fullCalendar.formatDate(event.end, "YYYY-MM-DD"),
                    };
                    if (!confirm("¿Está seguro que desea modificar la fecha y/o hora?")) {
                        revertFunc();
                    }
                    else {
                        $.ajax({
                            type: "POST",
                            url: "index.php?r=calendario/update-drop" + "&id=" + event_data.id 
                            + "&fecha_inicio=" + event_data.fecha_inicio + "&hora_inicio=" + event_data.hora_inicio 
                            + "&hora_termino=" + event_data.hora_termino + "&fecha_termino=" + event_data.fecha_termino,
                            success: function(json) {
                                alert("Fecha y/o hora modificada correctamente");
                            }
                        });
                    }
                }'
        ?>
    </p>

    <p>
        <?php
            $JsEventResize = 'function(event, delta, revertFunc) {
                    var event_data = {
                        id: event.id,
                        hora_inicio: $.fullCalendar.formatDate(event.start, "HH:mm"),
                        hora_termino: $.fullCalendar.formatDate(event.end, "HH:mm"),
                    };
                    if (!confirm("¿Está seguro que desea modificar la hora?")) {
                        revertFunc();
                    }
                    else {
                        $.ajax({
                            type: "POST",
                            url: "index.php?r=calendario/update-resize" + "&id=" + event_data.id 
                            + "&hora_inicio=" + event_data.hora_inicio + "&hora_termino=" + event_data.hora_termino,
                            success: function(json) {
                                alert("Hora modificada correctamente");
                            }
                        });
                    }
                }'
        ?>
    </p>

    <p>
        <?php
            $JsEventRender = 'function(event, element){
                element.popover({
                    title: "Descripción",
                    animation:true,
                    delay: 300,
                    placement: "top",
                    content: event.description,
                    trigger: "hover",
                    container: "body",
                });
            }'
        ?>
    </p>

    <p>
        <?= yii2fullcalendar\yii2fullcalendar::widget([
            'events' => $events,
            'id' => 'calendario',
            'options' => [
                      'lang' => 'es',
                    ],
            'clientOptions' => [
                    'selectable' => false,
                    'editable' => true,
                    'droppable' => true,
                    'header' => [
                        'left' => 'prev,next,today',
                        'center' => 'title',
                        'right' => 'month,agendaWeek,agendaDay,listDay',
                        ],
                'minTime' => '08:00',
                'maxTime' => '21:00',
                'height' => 'auto',
                'snapDuration' => '00:05:00',
                'eventRender' => new JsExpression($JsEventRender),
                'eventClick' => new JsExpression($JsEventClick),
                'eventDrop' => new JsExpression($JsEventDrop),
                'eventResize' => new JsExpression($JsEventResize),
                    ],
            ]);
        ?>
    </p>
</div>

В том-то и дело, что он не ломается, он просто не показывает модальный режим. Главное окно исчезает, но модальное не появляется.

calendario / site. css

.modal {
    overflow-y: scroll!important;
    overflow-x: visible;
    display: block;
    overflow: scroll;
}

.modal-header {
    border-bottom: 0 none;
    padding-bottom: 0px;    
}

.modal-body {
    padding-top: 0px;
    padding-bottom: 0px;
}

.modal-open {
    overflow: scroll;
    overflow-x: visible;
    overflow-y: scroll!important;
}

.modal-content{
    overflow: scroll;
}

adminlte. css

.modal-open {
  overflow: hidden;
}

.modal-open .modal {
  overflow-x: hidden;
  overflow-y: auto;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: 0;
}

.modal-dialog {
  position: relative;
  width: auto;
  margin: 0.5rem;
  pointer-events: none;
}

.modal.fade .modal-dialog {
  transition: -webkit-transform 0.3s ease-out;
  transition: transform 0.3s ease-out;
  transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out;
  -webkit-transform: translate(0, -50px);
  transform: translate(0, -50px);
}

@media (prefers-reduced-motion: reduce) {
  .modal.fade .modal-dialog {
    transition: none;
  }
}

.modal.show .modal-dialog {
  -webkit-transform: none;
  transform: none;
}

.modal-dialog-scrollable {
  display: -ms-flexbox;
  display: flex;
  max-height: calc(100% - 1rem);
}

.modal-dialog-scrollable .modal-content {
  max-height: calc(100vh - 1rem);
  overflow: hidden;
}

.modal-dialog-scrollable .modal-header,
.modal-dialog-scrollable .modal-footer {
  -ms-flex-negative: 0;
  flex-shrink: 0;
}

.modal-dialog-scrollable .modal-body {
  overflow-y: auto;
}

.modal-dialog-centered {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
  min-height: calc(100% - 1rem);
}

.modal-dialog-centered::before {
  display: block;
  height: calc(100vh - 1rem);
  content: "";
}

.modal-dialog-centered.modal-dialog-scrollable {
  -ms-flex-direction: column;
  flex-direction: column;
  -ms-flex-pack: center;
  justify-content: center;
  height: 100%;
}

.modal-dialog-centered.modal-dialog-scrollable .modal-content {
  max-height: none;
}

.modal-dialog-centered.modal-dialog-scrollable::before {
  content: none;
}

.modal-content {
  position: relative;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background-color: #ffffff;
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0.3rem;
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.5);
  outline: 0;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  width: 100vw;
  height: 100vh;
  background-color: #000;
}

.modal-backdrop.fade {
  opacity: 0;
}

.modal-backdrop.show {
  opacity: 0.5;
}

.modal-header {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: start;
  align-items: flex-start;
  -ms-flex-pack: justify;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
  border-top-left-radius: 0.3rem;
  border-top-right-radius: 0.3rem;
}

.modal-header .close, .modal-header .mailbox-attachment-close {
  padding: 1rem;
  margin: -1rem -1rem -1rem auto;
}

.modal-title {
  margin-bottom: 0;
  line-height: 1.5;
}

.modal-body {
  position: relative;
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  padding: 1rem;
}

.modal-footer {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-pack: end;
  justify-content: flex-end;
  padding: 1rem;
  border-top: 1px solid #e9ecef;
  border-bottom-right-radius: 0.3rem;
  border-bottom-left-radius: 0.3rem;
}

.modal-footer > :not(:first-child) {
  margin-left: .25rem;
}

.modal-footer > :not(:last-child) {
  margin-right: .25rem;
}

.modal-scrollbar-measure {
  position: absolute;
  top: -9999px;
  width: 50px;
  height: 50px;
  overflow: scroll;
}

@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
  }
  .modal-dialog-scrollable {
    max-height: calc(100% - 3.5rem);
  }
  .modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 3.5rem);
  }
  .modal-dialog-centered {
    min-height: calc(100% - 3.5rem);
  }
  .modal-dialog-centered::before {
    height: calc(100vh - 3.5rem);
  }
  .modal-content {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5);
  }
  .modal-sm {
    max-width: 300px;
  }
}

@media (min-width: 992px) {
  .modal-lg,
  .modal-xl {
    max-width: 800px;
  }
}

@media (min-width: 1200px) {
  .modal-xl {
    max-width: 1140px;
  }
}

Надеюсь не знаю, как отредактировать adminlte. css чтобы показать модальный календарь

1 Ответ

0 голосов
/ 20 апреля 2020

ну и для зрения есть некоторые конфликты между вашим js файлом, так что, если вы можете предоставить мне консоль ошибок, чтобы увидеть, что происходит, в противном случае я видел в вашей консоли немного красного цвета, что означает, что есть какая-то ошибка, что я советую удалить активы администратора Lte навсегда и попробуйте, если модель работает

...