<div class="container-xxl flex-grow-1 container-p-y" id="chat-orden-trabajo" data-id="<?= $modelId ?>">

    <div class="app-chat card overflow-hidden border">
        <div class="row g-0">
            <!-- Chat & Contacts -->
            <div class="col app-chat-contacts app-sidebar flex-grow-0 overflow-hidden border-end"
                id="app-chat-contacts">
                <div class="sidebar-header">
                    <div class="d-flex align-items-center me-3 me-lg-0">
                        <div class="flex-shrink-0 avatar me-3">
                            <span class="avatar-initial rounded-circle bg-label-success">U</span>
                        </div>

                        <div class="flex-grow-1 input-group input-group-merge rounded-pill">
                            <span class="input-group-text" id="basic-addon-search31">
                                <i class="ti ti-search"></i>
                            </span>
                            <input type="text" class="form-control chat-search-input"
                                placeholder="Buscar..." aria-label="Buscar..."
                                aria-describedby="basic-addon-search31" />
                        </div>
                    </div>
                    <i class="ti ti-x cursor-pointer d-lg-none d-block position-absolute mt-2 me-1 top-0 end-0"
                        data-overlay data-bs-toggle="sidebar" data-target="#app-chat-contacts"></i>
                </div>
                <hr class="container-m-nx m-0" />
                <div class="sidebar-body">
                    <div class="chat-contact-list-item-title">
                        <?php if (!auth()->user()->inGroup('cliente-administrador','cliente')): ?>
                            <div class="mb-0 px-4 pt-3 pb-2">
                                <select class="form-control chat-search-client"></select>
                            </div>
                        <?php endif; ?>
                    </div>

                    <div class="chat-contact-list-item-title">
                        <h5 class="text-primary mb-0 px-4 pt-3 pb-2">Departamentos</h5>
                    </div>
                    <!-- Chats -->
                    <ul class="list-unstyled chat-contact-list" id="chat-list">


                        <!-- CHAT LIST -->

                    </ul>

                </div>
            </div>
            <!-- /Chat contacts -->

            <!-- Chat History -->
            <div class="col app-chat-history bg-body">
                <div class="chat-history-wrapper ">
                    <div class="chat-history-header border-bottom">
                        <div class="d-flex justify-content-between align-items-center">
                            <div class="d-flex overflow-hidden align-items-center">
                                <i class="ti ti-menu-2 ti-sm cursor-pointer d-lg-none d-block me-2"
                                    data-bs-toggle="sidebar" data-overlay
                                    data-target="#app-chat-contacts"></i>
                                <div class="avatar d-block flex-shrink-0">
                                    <span
                                        class="avatar-initial rounded-circle bg-label-primary">P</span>
                                </div>
                                <div class="chat-contact-info flex-grow-1 ms-2">
                                    <h6 class="m-0"></h6>
                                    <small class="user-status text-muted"></small>
                                </div>

                            </div>

                            <div class="d-flex align-items-center">
                                <?php if (!auth()->user()->inGroup('cliente-administrador','cliente')): ?>

                                    <div class="ml-2 px-2">
                                        <button type="button" class="btn btn-danger btn-sm exit-chat">
                                            <i class="ti ti-trash"></i>
                                            <?= lang('Chat.exit_chat') ?>
                                        </button>
                                    </div>
                                    <div class="ml-2 px-2">
                                        <button type="button" class="btn btn-success btn-sm subscribe-chat">
                                            <i class="ti ti-plus"></i>
                                            <?= lang('Chat.subscribe_chat') ?>
                                        </button>
                                    </div>
                                <?php endif; ?>
                                <div class="dropdown d-flex align-self-center ml-2 px-2 d-none" id="chat-header-dropdown-users">
                                    <button type="button" class="btn btn-primary btn-icon rounded-pill dropdown-toggle hide-arrow" data-bs-toggle="dropdown">
                                        <i class="ti ti-users"></i>
                                    </button>
                                    <div class="dropdown-menu dropdown-menu-end mb-0 px-2 pt-3 pb-2" id="chat-header-users"
                                        aria-labelledby="chat-header-users">
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                    <div class="chat-history-body bg-body">
                        <div class="d-flex justify-content-center chat-loader">
                            <div class="sk-wave sk-primary ">
                                <div class="sk-wave-rect"></div>
                                <div class="sk-wave-rect"></div>
                                <div class="sk-wave-rect"></div>
                                <div class="sk-wave-rect"></div>
                                <div class="sk-wave-rect"></div>
                            </div>
                        </div>
                        <ul class="list-unstyled chat-history" id="chat-conversation">

                        </ul>
                    </div>
                    <!-- Chat message form -->
                    <div class="chat-history-footer shadow-sm">
                        <div
                            class="form-send-message d-flex justify-content-between align-items-center">
                            <input class="form-control message-input border-0 me-3 shadow-none"
                                placeholder="<?= lang('Chat.write_message_placeholder') ?>" />
                            <div class="message-actions d-flex align-items-center">
                                <?php if (!auth()->user()->inGroup('cliente-administrador','cliente')): ?>
                                    <button type="button" class="btn btn-primary d-flex send-msg-btn" style="color:white"
                                        id="send-msg-btn-deparment" disabled>
                                        <i class="ti ti-send me-md-1 me-0"></i>
                                        <span class="align-middle d-md-inline-block">Enviar</span>
                                    </button>
                                <?php else :  ?>
                                    <button type="button" class="btn btn-primary d-flex send-msg-btn" style="color:white"
                                        id="send-msg-btn-deparment-client">
                                        <i class="ti ti-send me-md-1 me-0"></i>
                                        <span class="align-middle d-md-inline-block">Enviar</span>
                                    </button>
                                <?php endif;  ?>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /Chat History -->

            <div class="app-overlay"></div>
        </div>
    </div>
</div>

<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
<?= $this->endSection() ?>
<!------------------------------------------------------->
<!-- Código JS logica -->
<!------------------------------------------------------->
<?= $this->section("additionalExternalJs") ?>
<script type="module" src="<?= site_url('assets/js/safekat/pages/chatOrdenTrabajo.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
<?= $this->endSection() ?>