
{% load crispy_forms_tags %}
{% load bloomerp %}

{% breadcrumb title='Create widget' model=model %}

<section class="section dashboard">
    <div class="row">

      <!-- Left side columns -->
      <div class="col-lg-12">
        <div class="row">

            <div class="card">
                <div class="card-body pt-3">
                    <h4 class="card-title">Add 
                        {% if form.form_name %}
                        {{form.form_name}}
                        {% else %}
                        {{model_name}}
                        {% endif %}
                    </h4>


                    <div class="row">
                        <div class="col-12 my-2">
                            
                            <!-- Progress bar -->
                            <div class="progress mb-4" style="height: 25px;">
                                <div class="progress-bar progress-bar-striped" role="progressbar" 
                                    style="width: {{wizard.steps.step1|percentage:wizard.steps.count|floatformat:0}}%" 
                                    aria-valuenow="{{wizard.steps.step1|percentage:wizard.steps.count|floatformat:0}}" 
                                    aria-valuemin="0" 
                                    aria-valuemax="100">
                                    {{wizard.steps.step1|percentage:wizard.steps.count|floatformat:0}}%</div>
                            </div>
                            <!-- End Progress bar -->
                            
                            <form action="" method="post" enctype="multipart/form-data">
                                {% csrf_token %}
                                <table>
                                    {{ wizard.management_form }}
                                    {% if wizard.form.forms %}
                                        {{ wizard.form.management_form }}
                                        {% for form in wizard.form.forms %}
                                            {{ form | crispy }}
                                        {% endfor %}
                                    {% else %}
                                        {{ wizard.form | crispy }}
                                    {% endif %}
                                </table>

                                <div class="btn-group" role="group">
                                    {% if wizard.steps.prev %}
                                        <button class="btn btn-primary" name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">
                                            Previous
                                        </button>
                                    {% endif %}
                                    <button type="submit" class="btn btn-primary"> Next</button>
                                </div>
                            </form>

                            
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
