<commit_before><%! from django.utils.translation import ugettext as _ %>
<%! from datetime import datetime, timedelta %>
<%! import pytz %>
<%page args="section_data"/>
<%include file="add_coupon_modal.html" args="section_data=section_data" />
<%include file="edit_coupon_modal.html" args="section_data=section_data" />
<%include file="set_course_mode_price_modal.html" args="section_data=section_data" />
<%include file="generate_registarion_codes_modal.html" args="section_data=section_data" />
<div class="ecommerce-wrapper">
   <h3 class="error-msgs" id="error-msg"></h3>
   <div id = "accordion">
      <div class="wrap">
         <h2>${_('Registration Codes')}</h2>
         <div>
            %if section_data['sales_admin']:
            <span class="code_tip">
                <p>${_('Create one or more pre-paid course enrollment codes. Students can use these codes to enroll in the course.')}</p>
                <a id="registration_code_generation_link" href="#reg_code_generation_modal" class="add blue-button">${_('Create Enrollment Codes')}</a>
            </span>
            %endif
            <p>${_('Download a .csv file of all enrollment codes for this course')}</p>
            <p>
            <form action="${ section_data['get_registration_code_csv_url'] }" id="download_registration_codes" method="post">
               <input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
               <input type="text" name="download_company_name" placeholder="Company Name (optional)"/>
               <input type="submit" name="list-registration-codes-csv" value="${_("Download All Enrollment Codes")}" data-csv="true">
            </form>
            </p>
            <p>${_('Download a .csv file of all unused enrollment codes for this course')}</p>
            <p>
            <form action="${ section_data['active_registration_code_csv_url'] }" id="active_registration_codes" method="post">
               <input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
               <input type="text" name="active_company_name" placeholder="Company Name (optional)"/>
               <input type="submit" name="active-registration-codes-csv" value="${_("Download Unused Enrollment Codes")}" data-csv="true">
            </form>
            </p>
            <p>${_('Download a .csv file of all used enrollment codes for this course')}</p>
            <p>
            <form action="${ section_data['spent_registration_code_csv_url'] }" id="spent_registration_codes" method="post">
               <input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
               <input type="text" name="spent_company_name" placeholder="Company Name (optional)"/>
               <input type="submit" name="spent-registration-codes-csv" value="${_("Download Used Enrollment Codes")}" data-csv="true">
            </form>
            </p>
           <a id="registration_code_generation_link-trigger" href="#registration_code_generation_modal" rel="leanModal"></a>
         </div>
      </div>
      <!-- end wrap -->
      %if section_data['coupons_enabled']:
      <div class="wrap">
         <h2>${_("Course Price")}</h2>
         <div>
            <span class="tip">${_("Course Price: ")}<span>${section_data['currency_symbol']}${section_data['course_price']}</span>
            %if section_data['access']['finance_admin'] is True:
            <a id="course_price_link" href="#set-course-mode-price-modal" rel="leanModal" class="add blue-button">+ ${_('Set Price')}</a>
            %endif
            </span>
         </div>
      </div>
      %endif
      <!-- end wrap -->
      %if section_data['access']['finance_admin']:
      <div class="wrap">
         <h2>${_("Sales")}</h2>
         <div>
            %if section_data['total_amount'] is not None:
              <span><strong>${_("Total Credit Card Purchases: ")}</strong></span><span>${section_data['currency_symbol']}${section_data['total_amount']}</span>
            %endif
            <span class="csv_tip">
              <div>
                <p>${_("Download a .csv file for all credit card purchases or for all invoices, regardless of status")}</p>
                <input type="button" class="add blue-button" name="list-sale-csv" value="${_("Download All Invoices")}" data-endpoint="${ section_data['get_sale_records_url'] }" data-csv="true">
                <input type="button" class="add blue-button" name="list-order-sale-csv" value="${_("Download All Credit Card Purchases")}" data-endpoint="${ section_data['get_sale_order_records_url'] }" data-csv="true">
              </div>
            </span>
             <hr>
             <p>${_("To cancel or resubmit an invoice, enter the invoice number below.")}</p>
            <span class="invalid_sale">
               <input type="number" id="invoice_number" placeholder= "${_("Invoice Number")}"/>
               <input type="button" class="add blue-button" id="invalidate_invoice" value="${_("Cancel Invoice")}">
               <input type="button" class="add blue-button" id="re_validate_invoice" value="${_("Resubmit Invoice")}">
            </span>

         </div>
      </div><!-- end wrap -->
      %endif
      %if section_data['coupons_enabled']:
      <div class="wrap">
         <h2>${_("Coupons List")}</h2>
         <div>

            <span class="csv_tip">${_("Click to generate a CSV file of all Coupon Codes:")}
                <input class="add blue-button" type="button" name="download-coupon-codes-csv" value="${_("Download coupon codes")}" data-endpoint="${ section_data['download_coupon_codes_url'] }" data-csv="true">
            </span>

            <span class="tip">${_("Coupons Information")} <a id="add_coupon_link" href="#add-coupon-modal" rel="leanModal"
               class="add blue-button">+ ${_("Add Coupon")}</a></span>
            <div class="wrapper-content wrapper">
               <section class="content">
                  %if len(section_data['coupons']):
                  <table class="coupons-table">
                     <thead>
                        <tr class="coupons-headings">
                           <th class="c_code">${_("Code")}</th>
                           <th class="c_dsc">${_("Description")}</th>
                           <th class="c_expiry">${_("Expiry Date")}</th>
                           <th class="c_discount">${_("Discount (%)")}</th>
                           <th class="c_count">${_("Redeem Count")}</th>
                           <th class="c_action">${_("Actions")}</th>
                        </tr>
                     </thead>
                     <tbody>
                        %for coupon in section_data['coupons']:
                        <% current_date = datetime.now(pytz.UTC) %>
                        <% coupon_expiry_date = coupon.expiration_date %>
                        %if coupon.is_active == False:
                        <tr class="coupons-items inactive_coupon">
                        %elif coupon_expiry_date is not None and current_date >= coupon_expiry_date:
                        <tr class="coupons-items expired_coupon">
                        %else:
                        <tr class="coupons-items">
                           %endif
                            <td>${_('{code}').format(code=coupon.code)}</td>
                            <td>${_('{description}').format(description=coupon.description)}</td>
                            <td>
                                ${coupon.display_expiry_date}
                            </td>
                            <td>${_('{discount}').format(discount=coupon.percentage_discount)}</td>
                           <td>${ coupon.couponredemption_set.filter(order__status='purchased').count() }</td>
                           <td><a data-item-id="${coupon.id}" class='remove_coupon' href='#'>[x]</a><a href="#edit-modal" data-item-id="${coupon.id}" class="edit-right">${_('Edit')}</a></td>
                        </tr>
                        %endfor
                     </tbody>
                  </table>
                  <a id="edit-modal-trigger" href="#edit-coupon-modal" rel="leanModal"></a>
                  %endif
               </section>
            </div>
         </div>
      </div>
      %endif
      <!-- end wrap -->
   </div>
</div>
<script>

   $(function () {
       var icons = {
           header: "ui-fa-circle-arrow-e",
           activeHeader: "ui-fa-circle-arrow-s"
       };
       var act = 0;
       $("#accordion").accordion(
               {
                   heightStyle: 'content',
                   activate: function(event, ui) {
                    var active = jQuery("#accordion").accordion('option', 'active');
                    $.cookie('saved_index', null);
                    $.cookie('saved_index', active);
                    $('#error-msg').val('');
                    $("#error-msg").fadeOut(2000 , function(){
                        $('#error-msg').hide()
                    });
                   },
                   animate: 400,<commit_msg>ECOM-986 updated class being used by JS for carats to use classes being loaded on the page via lms-style-course-vendor.css<commit_after><%! from django.utils.translation import ugettext as _ %>
<%! from datetime import datetime, timedelta %>
<%! import pytz %>
<%page args="section_data"/>
<%include file="add_coupon_modal.html" args="section_data=section_data" />
<%include file="edit_coupon_modal.html" args="section_data=section_data" />
<%include file="set_course_mode_price_modal.html" args="section_data=section_data" />
<%include file="generate_registarion_codes_modal.html" args="section_data=section_data" />
<div class="ecommerce-wrapper">
   <h3 class="error-msgs" id="error-msg"></h3>
   <div id = "accordion">
      <div class="wrap">
         <h2>${_('Registration Codes')}</h2>
         <div>
            %if section_data['sales_admin']:
            <span class="code_tip">
                <p>${_('Create one or more pre-paid course enrollment codes. Students can use these codes to enroll in the course.')}</p>
                <a id="registration_code_generation_link" href="#reg_code_generation_modal" class="add blue-button">${_('Create Enrollment Codes')}</a>
            </span>
            %endif
            <p>${_('Download a .csv file of all enrollment codes for this course')}</p>
            <p>
            <form action="${ section_data['get_registration_code_csv_url'] }" id="download_registration_codes" method="post">
               <input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
               <input type="text" name="download_company_name" placeholder="Company Name (optional)"/>
               <input type="submit" name="list-registration-codes-csv" value="${_("Download All Enrollment Codes")}" data-csv="true">
            </form>
            </p>
            <p>${_('Download a .csv file of all unused enrollment codes for this course')}</p>
            <p>
            <form action="${ section_data['active_registration_code_csv_url'] }" id="active_registration_codes" method="post">
               <input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
               <input type="text" name="active_company_name" placeholder="Company Name (optional)"/>
               <input type="submit" name="active-registration-codes-csv" value="${_("Download Unused Enrollment Codes")}" data-csv="true">
            </form>
            </p>
            <p>${_('Download a .csv file of all used enrollment codes for this course')}</p>
            <p>
            <form action="${ section_data['spent_registration_code_csv_url'] }" id="spent_registration_codes" method="post">
               <input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
               <input type="text" name="spent_company_name" placeholder="Company Name (optional)"/>
               <input type="submit" name="spent-registration-codes-csv" value="${_("Download Used Enrollment Codes")}" data-csv="true">
            </form>
            </p>
           <a id="registration_code_generation_link-trigger" href="#registration_code_generation_modal" rel="leanModal"></a>
         </div>
      </div>
      <!-- end wrap -->
      %if section_data['coupons_enabled']:
      <div class="wrap">
         <h2>${_("Course Price")}</h2>
         <div>
            <span class="tip">${_("Course Price: ")}<span>${section_data['currency_symbol']}${section_data['course_price']}</span>
            %if section_data['access']['finance_admin'] is True:
            <a id="course_price_link" href="#set-course-mode-price-modal" rel="leanModal" class="add blue-button">+ ${_('Set Price')}</a>
            %endif
            </span>
         </div>
      </div>
      %endif
      <!-- end wrap -->
      %if section_data['access']['finance_admin']:
      <div class="wrap">
         <h2>${_("Sales")}</h2>
         <div>
            %if section_data['total_amount'] is not None:
              <span><strong>${_("Total Credit Card Purchases: ")}</strong></span><span>${section_data['currency_symbol']}${section_data['total_amount']}</span>
            %endif
            <span class="csv_tip">
              <div>
                <p>${_("Download a .csv file for all credit card purchases or for all invoices, regardless of status")}</p>
                <input type="button" class="add blue-button" name="list-sale-csv" value="${_("Download All Invoices")}" data-endpoint="${ section_data['get_sale_records_url'] }" data-csv="true">
                <input type="button" class="add blue-button" name="list-order-sale-csv" value="${_("Download All Credit Card Purchases")}" data-endpoint="${ section_data['get_sale_order_records_url'] }" data-csv="true">
              </div>
            </span>
             <hr>
             <p>${_("To cancel or resubmit an invoice, enter the invoice number below.")}</p>
            <span class="invalid_sale">
               <input type="number" id="invoice_number" placeholder= "${_("Invoice Number")}"/>
               <input type="button" class="add blue-button" id="invalidate_invoice" value="${_("Cancel Invoice")}">
               <input type="button" class="add blue-button" id="re_validate_invoice" value="${_("Resubmit Invoice")}">
            </span>

         </div>
      </div><!-- end wrap -->
      %endif
      %if section_data['coupons_enabled']:
      <div class="wrap">
         <h2>${_("Coupons List")}</h2>
         <div>

            <span class="csv_tip">${_("Click to generate a CSV file of all Coupon Codes:")}
                <input class="add blue-button" type="button" name="download-coupon-codes-csv" value="${_("Download coupon codes")}" data-endpoint="${ section_data['download_coupon_codes_url'] }" data-csv="true">
            </span>

            <span class="tip">${_("Coupons Information")} <a id="add_coupon_link" href="#add-coupon-modal" rel="leanModal"
               class="add blue-button">+ ${_("Add Coupon")}</a></span>
            <div class="wrapper-content wrapper">
               <section class="content">
                  %if len(section_data['coupons']):
                  <table class="coupons-table">
                     <thead>
                        <tr class="coupons-headings">
                           <th class="c_code">${_("Code")}</th>
                           <th class="c_dsc">${_("Description")}</th>
                           <th class="c_expiry">${_("Expiry Date")}</th>
                           <th class="c_discount">${_("Discount (%)")}</th>
                           <th class="c_count">${_("Redeem Count")}</th>
                           <th class="c_action">${_("Actions")}</th>
                        </tr>
                     </thead>
                     <tbody>
                        %for coupon in section_data['coupons']:
                        <% current_date = datetime.now(pytz.UTC) %>
                        <% coupon_expiry_date = coupon.expiration_date %>
                        %if coupon.is_active == False:
                        <tr class="coupons-items inactive_coupon">
                        %elif coupon_expiry_date is not None and current_date >= coupon_expiry_date:
                        <tr class="coupons-items expired_coupon">
                        %else:
                        <tr class="coupons-items">
                           %endif
                            <td>${_('{code}').format(code=coupon.code)}</td>
                            <td>${_('{description}').format(description=coupon.description)}</td>
                            <td>
                                ${coupon.display_expiry_date}
                            </td>
                            <td>${_('{discount}').format(discount=coupon.percentage_discount)}</td>
                           <td>${ coupon.couponredemption_set.filter(order__status='purchased').count() }</td>
                           <td><a data-item-id="${coupon.id}" class='remove_coupon' href='#'>[x]</a><a href="#edit-modal" data-item-id="${coupon.id}" class="edit-right">${_('Edit')}</a></td>
                        </tr>
                        %endfor
                     </tbody>
                  </table>
                  <a id="edit-modal-trigger" href="#edit-coupon-modal" rel="leanModal"></a>
                  %endif
               </section>
            </div>
         </div>
      </div>
      %endif
      <!-- end wrap -->
   </div>
</div>
<script>

   $(function () {
       var icons = {
           header: "ui-icon-carat-1-e",
           activeHeader: "ui-icon-carat-1-s"
       };
       var act = 0;
       $("#accordion").accordion(
               {
                   heightStyle: 'content',
                   activate: function(event, ui) {
                    var active = jQuery("#accordion").accordion('option', 'active');
                    $.cookie('saved_index', null);
                    $.cookie('saved_index', active);
                    $('#error-msg').val('');
                    $("#error-msg").fadeOut(2000 , function(){
                        $('#error-msg').hide()
                    });
                   },
                   animate: 400,
{'fraction_non_alphanumeric': 0.16528335073929534, 'fraction_numerical': 0.0022536140273731655, 'mean_word_length': 2.0537092984222896, 'pattern_counts': {'":': 0, '<': 325, '<?xml version=': 0, '>': 327, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '980562', 'n_tokens_mistral': 5296, 'n_tokens_neox': 5134, 'n_words': 1001}