{% include 'header.html' %}
                <!-- Begin Page Content -->
                <div class="container-fluid">

                    <!-- Page Heading -->
                    <div class="d-sm-flex align-items-center justify-content-between mb-4">
                        <h1 class="h3 mb-0 text-gray-800">Preprocessing</h1>
                    </div>

                    <!-- Content Row -->
                    <div class="row">

                        <div class="col-sm-12">
                            <!-- Illustrations -->
                            <div class="card shadow mb-4">
                                <div class="card-header py-3">
                                    <h6 class="m-0 font-weight-bold text-primary">Preprocessing Data Tweet</h6>
                                </div>
                                <div class="card-body">
                                    <form method="post" action="" enctype="multipart/form-data">
                                        <div class="form-group">
                                            <label for="exampleFormControlFile1">Upload File</label>
                                            <input type="file" name="file" class="form-control-file" id="exampleFormControlFile1">
                                            <small id="" class="form-text text-muted">Upload file hasil scraping berekstensi .csv</small>

                                            {% with messages = get_flashed_messages(category_filter=["upload_gagal"]) %}
                                                {% if messages %}
                                                <small id="" class="form-text text-danger">{{ messages[0] }}</small>
                                                {% endif %}                     
                                            {% endwith %}

                                            {% with messages = get_flashed_messages(category_filter=["upload_berhasil"]) %}
                                                {% if messages %}
                                                <small id="" class="form-text text-success">{{ messages[0] }}</small>
                                                {% endif %}                     
                                            {% endwith %}

                                            {% with messages = get_flashed_messages(category_filter=["preprocessing_data"]) %}
                                                {% if messages %}
                                                <small id="" class="form-text text-success">{{ messages[0] }}</small>
                                                {% endif %}                     
                                            {% endwith %}
                                        </div>
                                        <input type="submit" value="Upload Data" name="upload" class="btn btn-primary">
                                        <input type="submit" value="Preprocessing Data" name="preprocess" class="btn btn-primary">
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- DataTales Show -->
                    
                    <div class="card shadow mb-4">
                        <div class="card-header py-3">
                            <h6 class="m-0 font-weight-bold text-primary">
                                Hasil Preprocessing
                                <a href="{{ url_for('static', filename='files/Data Preprocessing.csv') }}" target="blank" class="d-none d-sm-inline-block btn-sm btn-primary float-right shadow-sm"><i
                                    class="fas fa-download fa-sm text-white-50"></i> Download Data</a>
                            </h6>
                            
                        </div>
                        <div class="card-body">
                            <div class="table-responsive">
                                <table class="table table-striped" id="dataTable" width="100%" cellspacing="0" >
                                    <thead>
                                        <tr>
                                            <th>No</th>
                                            <th>Tanggal</th>
                                            <th>Username</th>
                                            <th>Tweet</th>
                                            <th>Cleansing</th>
                                            <th>Case Folding</th>
                                            <th>Normalisasi</th>
                                            <th>Tokenizing</th>
                                            <th>Stopword</th>
                                            <th>Stemming</th>
                                        </tr>
                                    </thead>
                                    <tfoot>
                                        <tr>
                                            <th>No</th>
                                            <th>Tanggal</th>
                                            <th>Username</th>
                                            <th>Tweet</th>
                                            <th>Cleansing</th>
                                            <th>Case Folding</th>
                                            <th>Normalisasi</th>
                                            <th>Tokenizing</th>
                                            <th>Stopword</th>
                                            <th>Stemming</th>
                                        </tr>
                                    </tfoot>
                                    <tbody>
                                        {% set count = namespace(value=1) %}
                                        {% for item in value %}
                                        <tr>
                                            <td>{{ count.value }}</td>
                                            <td>{{ item[0] }}</td>
                                            <td>{{ item[1] }}</td>
                                            <td>{{ item[2] }}</td>
                                            <td>{{ item[3] }}</td>
                                            <td>{{ item[4] }}</td>
                                            <td>{{ item[5] }}</td>
                                            <td>{{ item[6] }}</td>
                                            <td>{{ item[7] }}</td>
                                            <td>{{ item[8] }}</td>
                                        </tr>
                                        {% set count.value = count.value + 1 %}
                                        {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    

                </div>
                <!-- /.container-fluid -->
{% include 'footer.html' %}