<div class="alerts" tabindex="-1" aria-live="polite"></div>

<div class="row">
    <div class="fields col-md-6">
        <div class="form-group">
            <label for="title"><%= gettext('Coupon Name') %> *</label>
            <input id="title" type="text" class="form-control" name="title" maxlength="30">
            <p class="help-block"></p>
        </div>
        <div class="form-group">
            <label for="code-type"><%= gettext('Code Type') %></label>
            <select id="code-type" class="form-control non-editable" name="code_type"></select>
            <p class="help-block"></p>
        </div>
      <div class="form-group">
        <label for="category"><%= gettext('Category') %> *</label>
        <select id="category" class="form-control" name="category"></select>
        <p class="help-block"></p>
      </div>

        <div class="row">
            <div class="form-group col-md-6">
                <label for="start-date"><%= gettext('Valid from') %> *</label>
                <div class="input-group">
                    <div class="input-group-addon"><i class="fa fa-calendar" aria-hidden="true"></i></div>
                    <input id="start-date" placeholder="<%- gettext('YYYY-MM-DDTHH:mm:ss') %>" class="form-control add-pikaday" name="start_date">
                </div>
                <p class="help-block"></p>
            </div>
            <div class="form-group col-md-6">
                <label for="end-date"><%= gettext('Valid until') %> *</label>
                <div class="input-group">
                    <div class="input-group-addon"><i class="fa fa-calendar" aria-hidden="true"></i></div>
                    <input id="end-date" placeholder="<%- gettext('YYYY-MM-DDTHH:mm:ss') %>" class="form-control add-pikaday" name="end_date">
                </div>
                <p class="help-block"></p>
            </div>
        </div>

        <div class="form-group">
            <label for="voucher-type"><%= gettext('Usage Limitations') %></label>
            <select id="voucher-type" class="form-control non-editable" name="voucher_type"></select>
            <p class="help-block"></p>
        </div>

        <div class="form-group">
            <label for="code"><%= gettext('Code') %></label>
            <input id="code" type="text" class="form-control non-editable" name="code" placeholder="<%= gettext('optional') %>">
            <p class="help-block"></p>
        </div>

        <div class="form-group">
            <label for="quantity"><%= gettext('Number of Codes') %></label>
            <input id="quantity" type="number" step="1" class="form-control non-editable" name="quantity" value="1" min="1">
            <p class="help-block"></p>
        </div>

        <div class="form-group">
            <label for="max-uses"><%= gettext('Maximum Number of Uses') %></label>
            <input id="max-uses" type="number" step="1" class="form-control non-editable" name="max_uses" value="1" min="1">
            <p class="help-block"></p>
        </div>

        <div class="form-group">
            <label for="benefit-value"><%= gettext('Discount Value') %> *</label>
            <div class="input-group">
                <div class="benefit-addon input-group-addon"></div>
                <input id="benefit-value" type="number" step="0.01" min="0" class="form-control benefit-value" name="benefit_value">
            </div>
            <div class="form-inline benefit-type">
                <input id="benefit-percent" type="radio" class="non-editable" name="benefit_type" value="Percentage">
                <label for="benefit-percent" class="normal-font-weight"><%= gettext('Percent') %></label>
                <input id="benefit-fixed" type="radio" class="non-editable" name="benefit_type" value="Absolute">
                <label for="benefit-fixed" class="normal-font-weight"><%= gettext('Fixed ($USD)') %></label>
            </div>
            <p class="help-block"></p>
        </div>

        <div class="form-group">
            <label for="client"><%= gettext('Client') %> *</label>
            <input id="client" type="text" class="form-control" name="client" maxlength="50">
            <p class="help-block"></p>
        </div>
 
        <hr>

        <div class="form-group">
            <label><%= gettext('Invoice Type') %></label>
            <div class="invoice-type row">
                <div class="form-inline col-md-4">
                    <input id="already-invoiced" type="radio" name="invoice_type" value="Prepaid">
                    <label for="already-invoiced" class="normal-font-weight"><%= gettext('Already invoiced') %></label>
                </div>
                <div class="form-inline col-md-6">
                    <input id="invoice-after-redemption" type="radio" name="invoice_type" value="Postpaid">
                    <label for="invoice-after-redemption" class="normal-font-weight"><%= gettext('Invoice after redemption') %></label>
                </div>
                <div class="form-inline col-md-2">
                    <input id="not-applicable" type="radio" name="invoice_type" value="Not-Applicable">
                    <label for="not-applicable" class="normal-font-weight"><%= gettext('N/A') %></label>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label for="invoice-number"><%= gettext('Invoice Number') %></label>
            <input id="invoice-number" class="form-control" type="text" name="invoice_number">
            <p class="help-block"></p>
        </div>

        <div class="form-group">
            <label for="price"><%= gettext('Invoiced Amount') %></label>
            <div class="input-group">
                <div class="input-group-addon">$</div>
                <input id="price" type="number" step="0.01" min="0" class="form-control" name="price">
            </div>
            <p class="help-block"></p>
        </div>

        <div class="form-group">
            <label for="invoice-payment-date"><%= gettext('Payment Date') %></label>
            <div class="input-group">
                <div class="input-group-addon"><span class="fa fa-calendar" aria-hidden="true"></span></div>
                <input id="invoice-payment-date" placeholder="<%- gettext('YYYY-MM-DDTHH:mm:ss') %>" class="form-control add-pikaday" name="invoice_payment_date">
            </div>
            <p class="help-block"></p>
        </div>

        <div class="form-group hidden">
            <label for="invoice-discount-value"><%= gettext('Discount per Code') %></label>
            <div class="input-group">
                <div class="invoice-discount-addon input-group-addon"></div>
                <input id="invoice-discount-value" type="number" step="0.01" min="0" class="form-control invoice-discount-value" name="invoice_discount_value">
            </div>
            <div class="form-inline invoice-discount-type">
                <input id="invoice-discount-percent" type="radio" name="invoice_discount_type" value="Percentage">
                <label for="invoice-discount-percent" class="normal-font-weight"><%= gettext('Percent') %></label>
                <input id="invoice-discount-fixed" type="radio" name="invoice_discount_type" value="Absolute">
                <label for="invoice-discount-fixed" class="normal-font-weight"><%= gettext('Fixed ($USD)') %></label>
            </div>
            <p class="help-block"></p>
        </div>

        <div class="form-group">
            <label for="tax-deducted-source"><%= gettext('Tax Deducted Source (TDS)') %></label>
            <div class="form-inline tax-deduction">
                <input id="tax-deducted" type="radio" name="tax_deduction" value="Yes">
                <label for="tax-deducted" class="normal-font-weight"><%= gettext('Yes') %></label>
                <input id="non-tax-deducted" type="radio" name="tax_deduction" value="No" checked> 
                <label for="non-tax-deducted" class="normal-font-weight"><%= gettext('No') %></label>
            </div>
        </div>

        <div class="form-group hidden">
            <div class="input-group tax-deducted-source-value">
                <input id="tax-deducted-source-value" type="number" step="1" min="1" max="100" class="form-control" name="tax_deducted_source_value">
                <div class="input-group-addon">%</div>
                <p class="help-block"></p>
            </div>
        </div>
    </div>

    <div class="fields col-md-6">
        <div class="form-group">
            <div class="form-inline catalog-type">
                <input id="single-course" type="radio" class="non-editable" name="catalog_type" value="Single course">
                <label for="single-course"><%= gettext('Single course') %></label>
                <input id="multiple-courses" type="radio" class="non-editable" name="catalog_type" value="Multiple courses">
                <label for="multiple-courses"><%= gettext('Multiple courses') %></label>
            </div>
            <p class="help-block"></p>
        </div>
        <div class="form-group">
            <label for="course-id"><%= gettext('Course ID') %> *</label>
            <input id="course-id" type="text" class="form-control non-editable" name="course_id">
            <p class="help-block"></p>
        </div>
        <div class="form-group">
            <label for="seat-type"><%= gettext('Seat Type') %> *</label>
            <select id="seat-type" class="form-control non-editable" name="seat_type"></select>
            <p class="help-block"></p>
        </div>
        <div class="form-group catalog-query">
            <label for="catalog-query"><%= gettext('Valid for:') %> *</label>
            <textarea id="catalog-query" class="form-control" name="catalog_query" rows="10"></textarea>
            <p class="help-block"></p>
        </div>
        <div class="form-group course-seat-types">
            <label for="course-seat-types"><%= gettext('Seat Types:') %></label>
            <div class="checkboxes">
                <input id="verified" type="checkbox" name="course_seat_types" value="verified">
                <label for="verified"><%= gettext('Verified') %></label>
                <input id="professional" type="checkbox" name="course_seat_types" value="professional">
                <label for="professional"><%= gettext('Professional') %></label>
                <p class="help-block"></p>
            </div>
            <div class="catalog_buttons"></div>
        </div>
        <div class="form-group">
            <label for="note"><%= gettext('Note') %></label>
            <input id="note" type="text" class="form-control" name="note" maxlength="100">
            <p class="help-block"></p>
        </div>
    </div>
</div>

<div class="form-actions">
    <button type="submit" class="btn btn-primary"></button>
    <a class="btn btn-default" href="/coupons/<% if(id){ print(id + '/'); } %>"><%= gettext('Cancel') %></a>
</div>
