<!-- Sidebar -->
<?php $this->load->view('restricted/layout/sidebar_author'); ?>
<!-- Sidebar -->

<div id="content-wrapper" class="d-flex flex-column">
    <div id="content">

        <!-- NavBar -->
        <?php $this->load->view('restricted/layout/navbar'); ?>
        <!-- Navbar -->

        <!-- Container Fluid-->
        <div class="container-fluid pl-5 pr-5" id="container-wrapper">
            <div class="d-sm-flex align-items-center justify-content-between mb-4">
                <h1 class="h3 mb-0 text-gray-800"><?php echo $title; ?></h1>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="./">Home</a></li>
                    <li class="breadcrumb-item active" aria-current="page"><?php echo $title; ?></li>
                </ol>
            </div>


            <div class="card px-0 pt-4 p-4 mt-3 mb-3">
                <h5 id="heading"><?php echo $title; ?></h5>
                <p>Leia atentamente e preencha os campos a seguir.</p>

                <?php 
                if(isset($chapter)){
                    $chapter_id = $chapter->id;
                } else {
                    $chapter_id = '';
                }

                ?>
                <?php $attributes = array('id' => 'chapter_form'); ?>
                <?php echo form_open_multipart('restricted/author/home/core/' . $chapter_id, $attributes); ?>
                    <!-- progressbar -->
                    <ul id="progressbar">
                        <li class="active" id="book"><strong>Selecione o livro</strong></li>
                        <li id="submission"><strong>Regras de submissão</strong></li>
                        <li id="authors"><strong>Autores</strong></li>
                        <li id="informations"><strong>Detalhes</strong></li>
                        <li id="keywords"><strong>Palavras-chave</strong></li>
                        <li id="document"><strong>Documento</strong></li>
                        <li id="confirm"><strong>Verificação</strong></li>
                    </ul>
                    <div class="progress">
                        <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div>
                    </div> <br> <!-- fieldsets -->

                    <!-- Step 1 -->
                    <fieldset>
                        <div class="form-card">
                            <div class="row">
                                <div class="col-7">
                                    <h2 class="fs-title">Selecione o livro que deseja submeter um capítulo:</h2>
                                </div>
                                <div class="col-5">
                                    <h2 class="steps">Passo 1 - 7</h2>
                                </div>
                            </div>
                            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sapiente impedit ipsam delectus odio quas ipsum aspernatur error fuga, totam dolores.</p>

                            <div class="card col-sm-4 p-3" style="margin: 0 auto;">
                                <h6 class="m-0 font-weight-bold text-primary">Selecione o livro</h6>

                                <div class="col-sm-12 p-5">
                                    <input type="hidden" id="get_book_url" value="<?php echo base_url('restricted/author/home/get_book/'); ?>">
                                    <select class="form-control select" data-toggle="select" name="book_id" id="book_id" required>
                                    <?php if($books): ?>
                                    <?php foreach($books as $book): ?>
                                    <?php if($chapter): ?>
                                        <option value="0"></option>
                                        <option value="<?php echo $book->id; ?>" <?php echo ($chapter->book_id == $book->id) ? 'selected' : '' ?>><?php echo $book->title; ?></option>
                                    <?php else: ?>
                                        <option value="0"></option>
                                        <option value="<?php echo $book->id; ?>"><?php echo $book->title; ?></option>
                                    <?php endif; ?>
                                    <?php endforeach; ?>
                                    <?php else: ?>
                                        <option>Nenum registro encontrado...</option>
                                    <?php endif; ?>
                                    </select>
                                </div>
                            </div>
                            
                        </div>
                        <input type="button" name="next" class="next next_step1 action-button" value="Próximo" />
                    </fieldset>
                    <!-- /Step 1 -->

                    <!-- Step 2 -->
                    <fieldset>
                        <div class="form-card mb-3">
                            <div class="row">
                                <div class="col-7">
                                    <h2 class="fs-title">Regras de submissão:</h2>
                                </div>
                                <div class="col-5">
                                    <h2 class="steps">Passo 2 - 7</h2>
                                </div>
                            </div>
                            
                            <!-- Submission rules -->
                            <p class="p-5" id="submission_rules"></p>
                            <!-- /Submission rules -->

                        </div>

                        <div class="form-check mt-5 mb-0">
                            <input type="checkbox" class="pulse" name="step2_checkbox" id="step2_checkbox">
                            <label class="form-check-label h5" for="step2_checkbox">
                            Eu compreendo e concordo com os termos acima.
                            </label>
                        </div>

                        <input type="button" name="next" class="next action-button" value="Próximo" />
                        <input type="button" name="previous" class="previous action-button-previous" value="Voltar" />
                    </fieldset>
                    <!-- /Step 2 -->

                    <!-- Step 3 -->
                    <fieldset>
                        <div class="form-card">
                            <div class="row">
                                <div class="col-7">
                                    <h2 class="fs-title">Cadastre os co-autores do capítulo</h2>
                                </div>
                                <div class="col-5">
                                    <h2 class="steps">Passo 3 - 7</h2>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-lg-12 mt-4 mb-4">
                                    <!-- Co-author -->
                                    <div class="card">
                                        <div class="card-header d-flex flex-row align-items-center justify-content-between">
                                        <?php if(isset($co_authors)): ?>
                                            <h6 class="m-0 font-weight-bold text-primary">Coautores adicionados</h6>
                                            <?php else: ?>
                                                <h6 class="m-0 font-weight-bold text-primary">Adicionar coautor</h6>
                                        <?php endif; ?>
                                        </div>
                                        <div class="card-body">
                                            <div class="co-author-group">
                                                <div class="form-group row">
                                                    <?php if(isset($co_authors)): ?>
                                                    <?php foreach($co_authors as $co_author): ?>
                                                    <div class="col-sm-3 mt-3">
                                                        <input type="name" class="form-control" placeholder="Nome" value="<?php echo $co_author->co_author_name; ?>">
                                                    </div>
                                                    <div class="col-sm-3 mt-3">
                                                        <input type="email" class="form-control" placeholder="Email" value="<?php echo $co_author->co_author_email; ?>">
                                                    </div>
                                                    <div class="col-sm-2 mt-3">
                                                        <input type="text" class="form-control" placeholder="Telefone" value="<?php echo $co_author->co_author_phone; ?>">
                                                    </div>
                                                    <div class="col-sm-3 mt-3">
                                                        <input type="text" class="form-control" placeholder="Instituição" value="<?php echo $co_author->co_author_company; ?>">
                                                    </div>
                                                    <?php endforeach; ?>
                                                    <?php else: ?>
                                                        <div class="col-sm-3 mt-3">
                                                        <input type="name" class="form-control" name="co_author_name[]" id="co_author_name[]" placeholder="Nome">
                                                        </div>
                                                        <div class="col-sm-3 mt-3">
                                                            <input type="email" class="form-control" name="co_author_email[]" placeholder="Email">
                                                        </div>
                                                        <div class="col-sm-2 mt-3">
                                                            <input type="text" class="form-control phone_with_ddd" name="co_author_phone[]" placeholder="Telefone">
                                                        </div>
                                                        <div class="col-sm-3 mt-3">
                                                            <input type="text" class="form-control" name="co_author_company[]" placeholder="Instituição">
                                                        </div>
                                                    <?php endif; ?>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <!-- Co-author -->
                                    <div class="col-sm-3 mt-1">
                                        <button type="button" id="new-co-author" class="btn btn-primary">Adicionar novo</button>
                                    </div>

                                </div>
                                <!-- /Col -->
                            </div>
                            <!--Row-->


                        </div>
                        <input type="button" name="next" class="next action-button" value="Próximo" />
                        <input type="button" name="previous" class="previous action-button-previous" value="Voltar" />
                    </fieldset>
                    <!-- /Step 3 -->

                    <!-- Step 4 -->
                    <fieldset>
                        <div class="form-card">
                            <div class="row">
                                <div class="col-7">
                                    <h2 class="fs-title">Preencha o formulário abaixo:</h2>
                                </div>
                                <div class="col-5">
                                    <h2 class="steps">Passo 4 - 7</h2>
                                </div>
                            </div>

                            <label class="fieldlabels">Título do capítulo</label>
                            <input type="text" class="form-control" id="title" name="title" placeholder="Título..." value="<?php echo isset($chapter) ? $chapter->title : set_value('title'); ?>" />

                            <label class="fieldlabel pt-3">Resumo</label>
                            <textarea rows="20" class="form-control ck_editor_general" name="abstract" placeholder="Resumo..."></textarea>

                        </div>
                        <input type="button" name="next" class="next action-button" value="Próximo" />
                        <input type="button" name="previous" class="previous action-button-previous" value="Voltar" />
                    </fieldset>
                    <!-- /Step 4 -->

                    <!-- Step 5 -->
                    <fieldset>
                        <div class="form-card">
                            <div class="row">
                                <div class="col-7">
                                    <h2 class="fs-title">Digite as palavras-chave:</h2>
                                </div>
                                <div class="col-5">
                                    <h2 class="steps">Passo 5 - 7</h2>
                                </div>
                            </div>

                            <?php if(isset($chapter)): ?>
                                    <label class="fieldlabel pt-3">Keywords adicionadas</label><br>
                                    <h4><span class="badge badge-info"><?php echo $chapter->keywords; ?></span></h4>
                            <?php endif; ?>
                            <br><br>
                            <label class="fieldlabels">Palavras-chave</label><br>
                            <input type="text" id="keywords" name="keywords[]" data-role="tagsinput" placeholder="Digite aqui..."/>

                        </div>
                        <input type="button" name="next" class="next action-button" value="Próximo" />
                        <input type="button" name="previous" class="previous action-button-previous" value="Voltar" />
                    </fieldset>
                    <!-- /Step 5 -->


                    <!-- Step 6 -->
                    <fieldset>
                        <div class="form-card">
                            <div class="row">
                                <div class="col-7">
                                    <h2 class="fs-title">Enviar capítulo</h2>
                                </div>
                                <div class="col-5">
                                    <h2 class="steps">Passo 6 - 7</h2>
                                </div>
                            </div>

                            <div class="">
                                <p>
                                    Envie seu capítulo nessa seção. Por favor certifique-se que todos os seus textos, tabelas, figuras estão incluídos nesse documento. <br>
                                    Você deve verificar seu documento novamente antes do envio final para certificar-se de que o documento está completamente formatado e de acordo com as regras anteriores.
                                </p>
                                <h2 class="fs-title">Upload do capítulo:</h2>
                                <label class="fieldlabels">Envie seu documento:</label><br>
                                <div class="input-group mb-3 col-6">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text">Arquivo</span>
                                    </div>
                                    <div class="custom-file">
                                        <input type="file" class="custom-file-input" name="document" id="document">
                                        <label class="custom-file-label" for="document">Selecionar arquivos</label>
                                    </div>
                                </div>
                                <div class="input-group mb-3 col-12">
                                    <h4><img style="height: 30px;" src="<?php echo base_url('public/assets/restricted/img/file-check-alt-blue.svg'); ?>" alt=""><span id="document-name" class="badge badge-info"></span></h4>
                                </div>
                            </div>


                        </div>
                        <input type="button" name="next" class="next action-button" value="Próximo" onclick="showAbstract()"/>
                        <input type="button" name="previous" class="previous action-button-previous" value="Voltar" />
                    </fieldset>
                    <!-- /Step 6 -->

                    <!-- Step 7 -->
                    <fieldset>
                        <div class="form-card">
                            <div class="row">
                                <div class="col-7">
                                    <h2 class="fs-title">Verifique e finalize</h2>
                                </div>
                                <div class="col-5">
                                    <h2 class="steps">Passo 7 - 7</h2>
                                </div>
                            </div>

                            <div class="mt-3">
                                <div class="p-3">
                                    <h6 class="check-title">Título</h6>
                                    <h4><span id="check-title" class="badge badge-info"></span></h4>
                                </div>

                                <div class="p-3">
                                    <h6 class="check-title">Co-autores</h6>
                                    <h4><span id="check-co-author-name" class="badge badge-info"></span></h4>
                                    <h4><span id="check-co-author-email" class="badge badge-info"></span></h4>
                                    <h4><span id="check-co-author-phone" class="badge badge-info"></span></h4>
                                    <h4><span id="check-co-author-company" class="badge badge-info"></span></h4>
                                </div>

                                <div class="p-3">
                                    <h6 class="check-title">Resumo do capítulo</h6>
                                    <h4><span id="check-abstract" class="badge badge-info text-white"></span></h4>
                                </div>

                                <div class="p-3">
                                    <h6 class="check-title">Palavras-chave</h6>
                                    <h4><span id="check-keywords" class="badge badge-info"></span></h4>
                                </div>

                                <div class="p-3">
                                    <h6 class="check-title">Documento anexado</h6>
                                    <h4><img style="height: 30px;" src="<?php echo base_url('public/assets/restricted/img/file-check-alt-blue.svg'); ?>" alt=""><span id="check-document" class="badge badge-info"></span></h4>
                                </div>
                            </div>


                        </div>
                        <input type="submit" class="next action-button" value="Finalizar" />
                        <input type="button" name="previous" class="previous action-button-previous" value="Voltar" />
                    </fieldset>
                    <!-- /Step 7 -->

                <?php echo form_close(); ?>
            </div>







            <!-- Modal Logout -->
            <?php $this->load->view('restricted/layout/modal_logout'); ?>
            <!-- /Modal -->

        </div>
        <!--- /Container Fluid-->
    </div><!-- /Content -->