@extends('template')

@section('script')
    {!! Html::script('js/script.js') !!}
@endsection


<script>
    <?php  echo "var competences = " . json_encode($competenceItems) . "\n";?>
</script>

@section('nav')
    <ul id="dropdown1" class="dropdown-content" style="top : 20px">
        <li><a href="/auth/logout" class="logout">Logout</a></li>
    </ul>
    <nav>
        <div class="nav-wrapper">
            <a href="/" class="brand-logo">Banque</a>
            <ul class="right hide-on-med-and-down">
                <li><a class="dropdown-button" href="#!"
                       data-activates="dropdown1">{{ \Illuminate\Support\Facades\Auth::user()->login  }}<i
                                class="material-icons right">more_vert</i></a></li>
            </ul>
        </div>
    </nav>

@endsection

@section('contenu')

    <div class="container">
        <div class="filter-ghost close"></div>

        <div class="collection">
            @foreach($banqueItems as $banqueItem)
                <a href="#!" class="collection-item banque-item">{{ $banqueItem->label }}</a>
                <input type="hidden" id="banque-id" value={{ $banqueItem->id_Banque  }}>
            @endforeach
        </div>


        <div class="card large hide" id="addBanqueCard">

            <div class="passed card-panel green hide">
                <span class="white-text">Action passed</span>
            </div>

            <div class="failed card-panel red hide">
                <span class="white-text">Action failed</span>
            </div>

            <div class="header-title card-panel white show">
                <span class="black-text">Add to bank</span>
            </div>

            <div class="progress hide">
                <div class="indeterminate"></div>
            </div>

            <div class="card-content nano" style="height: 74% !important;">
                <div class="nano-content">

                    <div class="row">
                        <form class="col s12 banque-form" method="post" action="/banque/add">

                            {!! csrf_field() !!}

                            <div class="row">
                                <div class="input-field col s6">
                                    <select name="id_Contexte" id="id_Contexte">
                                        <option value="" disabled selected>Choisir contexte</option>
                                        @foreach($contexteItems as $contexteItem)
                                            <option value={{ $contexteItem->id_Contexte }}>{{ $contexteItem->nom }}</option>
                                        @endforeach
                                    </select>
                                    <label>Contexte:</label>
                                </div>
                                <div class="input-field col s6">
                                    <select name="id_Systeme" id="id_Systeme">
                                        <option value="" disabled selected>Choisir systeme</option>
                                        @foreach($systemeItems as $systemeItem)
                                            <option value={{ $systemeItem->id_Systeme }}>{{ $systemeItem->nom }}</option>
                                        @endforeach
                                    </select>
                                    <label>Systeme:</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s6">
                                    <select name="id_Domaine" id="id_Domaine">
                                        <option value="" disabled selected>Choisir domaine</option>
                                        @foreach($domaineItems as $domaineItem)
                                            <option value={{ $domaineItem->id_Domaine }}>{{ $domaineItem->nom }}</option>
                                        @endforeach
                                    </select>
                                    <label>Domaine:</label>
                                </div>
                                <div class="input-field col s6">
                                    <select name="id_Critere" id="id_Critere">
                                        <option value="" disabled selected>Choisir critere</option>
                                        @foreach($critereItems as $critereItem)
                                            <option value={{ $critereItem->id_Critere }}>{{ $critereItem->nom }}</option>
                                        @endforeach
                                    </select>
                                    <label>Critere:</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s6">
                                    <input placeholder=" " id="label" type="text" name="label">
                                    <label for="label">Label:</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s12">
                                <textarea id="situation_Clinique" class="materialize-textarea"
                                          name="situation_Clinique"></textarea>
                                    <label for="situation_Clinique">Situation clinique:</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s12">
                                <textarea id="instruction_Etudiant" class="materialize-textarea"
                                          name="instruction_Etudiant"></textarea>
                                    <label for="instruction_Etudiant">Instruction etudiant:</label>
                                </div>
                            </div>

                        </form>

                        <div class="col s12">
                            <label>Items:</label>
                        </div>

                        <div class="row items">

                            <div class="titre">

                                <div id="titre1">

                                    <form class="col s12 titre-form" method="post" action="/titre/add">

                                        {!! csrf_field() !!}

                                        <div class="input-field col s9">
                                            <input placeholder="Titre" id="nom" type="text" name="nom">
                                        </div>

                                        <div class="input-field col s2">
                                            <input placeholder="Ponderation" id="ponderation" type="number"
                                                   name="ponderation">
                                        </div>

                                    </form>

                                    <div class="titre-item">

                                        <div id="item1">

                                            <form class="col s12 item-form" method="post">

                                                {!! csrf_field() !!}

                                                <div class="input-field col s8">
                                                    <input placeholder="Item" id="label" type="text" name="label">
                                                </div>

                                                <div class="input-field col s2">
                                                    <input placeholder="Ponderation" id="valeur" type="number"
                                                           name="valeur">
                                                </div>

                                                <div class="input-field col m1 item_comp">
                                                    <select id="id_Competence" name="id_Competence">
                                                        @foreach($competenceItems as $competenceItem)
                                                            <option value={{ $competenceItem->id_Competence }}>{{ $competenceItem->prefix }}</option>
                                                        @endforeach
                                                    </select>
                                                </div>

                                                <input id="id_TitreGItem" type="hidden"
                                                       name="id_TitreGItem">

                                            </form>

                                        </div>

                                    </div>

                                    <div class="row">
                                        <a href="#" class="add-item" style="margin-left: 33px;" onclick="addItem(this)">Ajouter
                                            item</a>
                                    </div>

                                </div>

                            </div>

                            <div class="row">
                                <a href="#" class="add-titre" style="margin-left: 33px;" onclick="addTitre(this)">Ajouter
                                    titre</a>
                            </div>
                            <div class="files">
                                <div id="file1">

                                    <form class="col s12 file-form" method="post" action="/file/add" enctype="multipart/form-data">
                                        {!! csrf_field() !!}
                                        <div class="file-field input-field">
                                            <div class="btn">
                                                <span>File</span>
                                                <input type="file" name="file" id="file">
                                            </div>
                                            <div class="file-path-wrapper">
                                                <input class="file-path validate" type="text" id="file-name">
                                            </div>
                                        </div>
                                    </form>
                                </div>

                            </div>
                            <div class="row">
                                <a href="#" class="add-file" style="margin-left: 33px;" onclick="addFile(this)">Ajouter
                                    fichier</a>
                            </div>

                        </div>
                    </div>

                    <br>
                    <br>
                </div>
            </div>
            <div class="card-action">
                <a href="#" class="banque-submit-add">Submit</a>
                <a href="#" class="banque-reset-add">Reset</a>
            </div>
        </div>

        <div class="card large hide" id="editBanqueCard">

            <div class="passed card-panel green hide">
                <span class="white-text">Action passed</span>
            </div>

            <div class="failed card-panel red hide">
                <span class="white-text">Action failed</span>
            </div>

            <div class="header-title card-panel white show">
                <span class="black-text">Edit bank</span>
            </div>

            <div class="progress hide">
                <div class="indeterminate"></div>
            </div>

            <div class="card-content nano" style="height: 74% !important;">
                <div class="nano-content">

                    <div class="row">
                        <form class="col s12 banque-form" method="post" action="/banque/update">

                            {!! csrf_field() !!}

                            <div class="row">
                                <div class="input-field col s6">
                                    <select name="id_Contexte" id="id_Contexte">
                                        <option value="" disabled selected>Choisir contexte</option>
                                        @foreach($contexteItems as $contexteItem)
                                            <option value={{ $contexteItem->id_Contexte }}>{{ $contexteItem->nom }}</option>
                                        @endforeach
                                    </select>
                                    <label>Contexte:</label>
                                </div>
                                <div class="input-field col s6">
                                    <select name="id_Systeme" id="id_Systeme">
                                        <option value="" disabled selected>Choisir systeme</option>
                                        @foreach($systemeItems as $systemeItem)
                                            <option value={{ $systemeItem->id_Systeme }}>{{ $systemeItem->nom }}</option>
                                        @endforeach
                                    </select>
                                    <label>Systeme:</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s6">
                                    <select name="id_Domaine" id="id_Domaine">
                                        <option value="" disabled selected>Choisir domaine</option>
                                        @foreach($domaineItems as $domaineItem)
                                            <option value={{ $domaineItem->id_Domaine }}>{{ $domaineItem->nom }}</option>
                                        @endforeach
                                    </select>
                                    <label>Domaine:</label>
                                </div>
                                <div class="input-field col s6">
                                    <select name="id_Critere" id="id_Critere">
                                        <option value="" disabled selected>Choisir critere</option>
                                        @foreach($critereItems as $critereItem)
                                            <option value={{ $critereItem->id_Critere }}>{{ $critereItem->nom }}</option>
                                        @endforeach
                                    </select>
                                    <label>Critere:</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s6">
                                    <input placeholder=" " id="label" type="text" name="label">
                                    <label for="label">Label:</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s12">
                                <textarea id="situation_Clinique" class="materialize-textarea"
                                          name="situation_Clinique"></textarea>
                                    <label for="situation_Clinique">Situation clinique:</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s12">
                                <textarea id="instruction_Etudiant" class="materialize-textarea"
                                          name="instruction_Etudiant"></textarea>
                                    <label for="instruction_Etudiant">Instruction etudiant:</label>
                                </div>
                            </div>

                        </form>

                        <div class="col s12">
                            <label>Items:</label>
                        </div>

                        <div class="row items">

                            <div class="titre">

                                <div id="titre1">

                                    <form class="col s12 titre-form" method="post" action="/titre/edit">

                                        {!! csrf_field() !!}

                                        <div class="input-field col s9">
                                            <input placeholder="Titre" id="nom" type="text" name="nom">
                                        </div>

                                        <div class="input-field col s2">
                                            <input placeholder="Ponderation" id="ponderation" type="number"
                                                   name="ponderation">
                                        </div>

                                    </form>

                                    <div class="titre-item">

                                        <div id="item1">

                                            <form class="col s12 item-form" method="post">

                                                {!! csrf_field() !!}

                                                <div class="input-field col s8">
                                                    <input placeholder="Item" id="label" type="text" name="label">
                                                </div>

                                                <div class="input-field col s2">
                                                    <input placeholder="Ponderation" id="valeur" type="number"
                                                           name="valeur">
                                                </div>

                                                <div class="input-field col m1 item_comp">
                                                    <select id="id_Competence" name="id_Competence">
                                                        @foreach($competenceItems as $competenceItem)
                                                            <option value={{ $competenceItem->id_Competence }}>{{ $competenceItem->prefix }}</option>
                                                        @endforeach
                                                    </select>
                                                </div>

                                            </form>

                                        </div>

                                    </div>

                                    <div class="row">
                                        <a href="#" class="add-item" style="margin-left: 33px;" onclick="addItem(this)">Ajouter
                                            item</a>
                                    </div>

                                </div>

                            </div>

                            <div class="row">
                                <a href="#" class="add-titre" style="margin-left: 33px;" onclick="addTitre(this)">Ajouter
                                    titre</a>
                            </div>
                            <div class="files">
                                <div id="file1">

                                    <form class="col s12 file-form" method="post" action="/file/add" enctype="multipart/form-data">
                                        {!! csrf_field() !!}
                                        <div class="file-field input-field">
                                            <div class="btn">
                                                <span>File</span>
                                                <input type="file" id="file" name="file">
                                            </div>
                                            <div class="file-path-wrapper">
                                                <input class="file-path validate" type="text" id="file-name">
                                            </div>
                                        </div>
                                    </form>
                                </div>

                            </div>
                            <div class="row">
                                <a href="#" class="add-file" style="margin-left: 33px;" onclick="addFile(this)">Ajouter
                                    fichier</a>
                            </div>

                        </div>
                    </div>

                    <br>
                    <br>
                </div>
            </div>
            <div class="card-action">
                <a href="#" class="banque-submit-edit">Submit</a>
                <a href="#" class="banque-reset-edit">Reset</a>
            </div>
        </div>

    </div>
    <div class="fixed-action-btn" style="bottom: 45px; right: 24px;">
        <a class="btn-floating waves-effect waves-light btn-large red" id="addBanqueBtn"><i
                    class="material-icons">add</i></a>
    </div>
@endsection
