<commit_before>{{#edit-panel editPanelProps=editPanelProps}}
  {{#em-form model=model submitButton=false as |form|}}
    {{#unless model.isNew}}
      {{patient-summary patient=model.patient returnTo='invoices.edit' returnToContext=model.id disablePatientLink=model.isNew class="clickable"}}
    {{/unless}}
    <div class="row">
      {{#unless model.isNew}}
        <div class="form-group col-xs-2">
          <label>{{t 'labels.invoiceId'}}</label>
          <p class="form-control-static">{{model.id}}</p>
        </div>
      {{/unless}}
      {{date-picker model=model property="billDate" label=(t 'labels.billDate') class="col-xs-2"}}
      {{#if model.isNew}}
        {{patient-typeahead model=model property="patientTypeAhead" label=(t 'labels.patient') content=patientList selection=selectedPatient class="col-xs-4 required invoice-patient"}}
        {{form.select class="col-xs-4 required invoice-visit" label=(t 'labels.visit')
            property="visit" content=patientVisitsForSelect
            optionValuePath="selectObject" optionLabelPath="selectObject.visitDescription"
            selected=model.visit
            prompt='Please select a visit'
        }}
      {{else}}
        <div class="form-group col-xs-3">
          <label>{{t 'labels.visit'}}</label>
          <p class="form-control-static">{{model.visit.visitDescription}}</p>
        </div>
      {{/if}}
    </div>
    <div class="row">
      {{form.input property="externalInvoiceNumber" label=(t 'billing.labels.externalInvoiceNumber') class="col-xs-3 external-invoice-no"}}
      {{form.select label=(t 'billing.labels.paymentProfile')
        property="paymentProfile"
        content=pricingProfiles
        optionValuePath="selectObject"
        optionLabelPath="selectObject.name"
        class="col-xs-3"
        prompt=" "
        selected=model.paymentProfile
      }}
    </div>
  {{/em-form}}
  <form class="form-inline">
    <div class="panel detail-section">
      <div class="panel-heading">
        <h3 class="panel-title">
          {{t 'labels.lineItems'}}
          {{#if canAddCharge}}
            <button class="btn btn-primary align-right" {{action "showAddLineItem" bubbles=false }}><span class="octicon octicon-plus"></span>{{t 'buttons.addLineItem'}}</button>
          {{/if}}
        </h3>
      </div>
      <div class="panel-body detail-section-content">
        <table class="table">
          <tr class="table-header">
            <th class="col-xs-5">{{t 'labels.description'}}</th>
            <th class="col-xs-1 text-right">{{t 'billing.labels.actualCharges'}}</th>
            <th class="col-xs-1 text-right">{{t 'labels.discount'}}</th>
            <th class="col-xs-1 text-right">{{t 'billing.labels.insurance'}}</th>
            <th class="col-xs-1 text-right">{{t 'billing.labels.hmoCom'}}</th>
            <th class="col-xs-1 text-right">{{t 'labels.excess'}}</th>
            <th class="col-xs-2 text-right">{{t 'labels.action'}}</th>
          </tr>
          {{#each model.lineItemsByCategory as |categoryGroup|}}
            <tr>
              <td class="col-xs-12">
                <strong>{{categoryGroup.category}}</strong>
              </td>
            </tr>
            {{#each categoryGroup.items as |item|}}
              <tr>
                <td class="col-xs-5">
                  <div class="input-group">
                    <span class="input-group-addon glyphicon
                      {{if item.showDetails 'glyphicon-minus' 'glyphicon-plus'}}"
                        {{action "toggleDetails" item bubbles=false }}>
                    </span>
                    <strong>{{input class="form-control" value=item.name }}</strong>
                  </div>
                </td>
                <td class="col-xs-1 text-right">
                  {{number-format item.total}}
                </td>
                <td class="col-xs-1">
                  <div class="form-group">
                    {{input class="form-control text-right" value=item.discount }}
                  </div>
                </td>
                <td class="col-xs-1">
                  <div class="form-group">
                    {{input class="form-control text-right" value=item.nationalInsurance }}
                  </div>
                </td>
                <td class="col-xs-1">
                  <div class="form-group">
                    {{input class="form-control text-right" value=item.privateInsurance }}
                  </div>
                </td>
                <td class="col-xs-1 text-right">{{number-format item.amountOwed}}</td>
                <td class="col-xs-2">
                  {{#if canAddCharge}}
                    <button class="btn btn-default warning" {{action "showDeleteLineItem" item bubbles=false }}>
                      <span class="octicon octicon-x"></span>{{t 'buttons.delete'}}
                    </button>
                  {{/if}}
                </td>
              </tr>
              {{#if item.showDetails}}
                <tr>
                  <th colspan="2" class="col-xs-6">{{t 'labels.name'}}</th>
                  <th class="col-xs-1">{{t 'labels.quantity'}}</th>
                  <th class="col-xs-1">{{t 'labels.price'}}</th>
                  <th class="col-xs-1">{{t 'labels.expenseTo'}}</th>
                  <th class="col-xs-1 text-right">{{t 'labels.total'}}</th>
                  <th class="col-xs-2">
                    {{#if canAddCharge}}
                      <button class="btn btn-primary" {{action "addItemCharge" item}}>
                        <span class="octicon octicon-plus"></span>{{t 'admin.roles.capability.addCharge'}}
                      </button>
                    {{/if}}
                  </th>
                </tr>
                {{#each item.details as |detail|}}
                  <tr>
                    <td colspan="2" class="col-xs-6 input-group">
                      {{input class="form-control" value=detail.name }}
                    </td>
                    <td class="col-xs-1">
                      <div class="form-group">
                        {{input class="form-control" value=detail.quantity }}
                      </div>
                    </td>
                    <td class="col-xs-1">
                      <div class="form-group">
                        {{input class="form-control" value=detail.price }}
                      </div>
                    </td>
                    <td class="col-xs-1">
                      {{#em-form model=detail submitButton=false as |form|}}
                        {{form.select
                          class='form-input-group'
                          content=expenseAccountList
                          property='expenseAccount'
                        }}
                      {{/em-form}}
                    </td>
                    <td class="col-xs-1 text-right">
                      {{number-format detail.amountOwed}}
                    </td>
                    <td class="col-xs-2">
                      {{#if canAddCharge}}
                        <button class="btn btn-default warning" {{action "showDeleteItem" detail item.details bubbles=false }}>
                          <span class="octicon octicon-x"></span>{{t 'buttons.delete'}}
                        </button>
                      {{/if}}
                    </td>
                  </tr>
                {{/each}}
              {{/if}}
            {{/each}}
            <tr>
              <td>
                <strong>{{t 'labels.total'}} {{categoryGroup.category}}</strong>
              </td>
              <td class="text-right">{{number-format categoryGroup.total}}</td>
              <td class="text-right">{{number-format categoryGroup.discount}}</td><commit_msg>Replace with native HTML select<commit_after>{{#edit-panel editPanelProps=editPanelProps}}
  {{#em-form model=model submitButton=false as |form|}}
    {{#unless model.isNew}}
      {{patient-summary patient=model.patient returnTo='invoices.edit' returnToContext=model.id disablePatientLink=model.isNew class="clickable"}}
    {{/unless}}
    <div class="row">
      {{#unless model.isNew}}
        <div class="form-group col-xs-2">
          <label>{{t 'labels.invoiceId'}}</label>
          <p class="form-control-static">{{model.id}}</p>
        </div>
      {{/unless}}
      {{date-picker model=model property="billDate" label=(t 'labels.billDate') class="col-xs-2"}}
      {{#if model.isNew}}
        {{patient-typeahead model=model property="patientTypeAhead" label=(t 'labels.patient') content=patientList selection=selectedPatient class="col-xs-4 required invoice-patient"}}
        {{form.select class="col-xs-4 required invoice-visit" label=(t 'labels.visit')
            property="visit" content=patientVisitsForSelect
            optionValuePath="selectObject" optionLabelPath="selectObject.visitDescription"
            selected=model.visit
            prompt='Please select a visit'
        }}
      {{else}}
        <div class="form-group col-xs-3">
          <label>{{t 'labels.visit'}}</label>
          <p class="form-control-static">{{model.visit.visitDescription}}</p>
        </div>
      {{/if}}
    </div>
    <div class="row">
      {{form.input property="externalInvoiceNumber" label=(t 'billing.labels.externalInvoiceNumber') class="col-xs-3 external-invoice-no"}}
      {{form.select label=(t 'billing.labels.paymentProfile')
        property="paymentProfile"
        content=pricingProfiles
        optionValuePath="selectObject"
        optionLabelPath="selectObject.name"
        class="col-xs-3"
        prompt=" "
        selected=model.paymentProfile
      }}
    </div>
  {{/em-form}}
  <form class="form-inline">
    <div class="panel detail-section">
      <div class="panel-heading">
        <h3 class="panel-title">
          {{t 'labels.lineItems'}}
          {{#if canAddCharge}}
            <button class="btn btn-primary align-right" {{action "showAddLineItem" bubbles=false }}><span class="octicon octicon-plus"></span>{{t 'buttons.addLineItem'}}</button>
          {{/if}}
        </h3>
      </div>
      <div class="panel-body detail-section-content">
        <table class="table">
          <tr class="table-header">
            <th class="col-xs-5">{{t 'labels.description'}}</th>
            <th class="col-xs-1 text-right">{{t 'billing.labels.actualCharges'}}</th>
            <th class="col-xs-1 text-right">{{t 'labels.discount'}}</th>
            <th class="col-xs-1 text-right">{{t 'billing.labels.insurance'}}</th>
            <th class="col-xs-1 text-right">{{t 'billing.labels.hmoCom'}}</th>
            <th class="col-xs-1 text-right">{{t 'labels.excess'}}</th>
            <th class="col-xs-2 text-right">{{t 'labels.action'}}</th>
          </tr>
          {{#each model.lineItemsByCategory as |categoryGroup|}}
            <tr>
              <td class="col-xs-12">
                <strong>{{categoryGroup.category}}</strong>
              </td>
            </tr>
            {{#each categoryGroup.items as |item|}}
              <tr>
                <td class="col-xs-5">
                  <div class="input-group">
                    <span class="input-group-addon glyphicon
                      {{if item.showDetails 'glyphicon-minus' 'glyphicon-plus'}}"
                        {{action "toggleDetails" item bubbles=false }}>
                    </span>
                    <strong>{{input class="form-control" value=item.name }}</strong>
                  </div>
                </td>
                <td class="col-xs-1 text-right">
                  {{number-format item.total}}
                </td>
                <td class="col-xs-1">
                  <div class="form-group">
                    {{input class="form-control text-right" value=item.discount }}
                  </div>
                </td>
                <td class="col-xs-1">
                  <div class="form-group">
                    {{input class="form-control text-right" value=item.nationalInsurance }}
                  </div>
                </td>
                <td class="col-xs-1">
                  <div class="form-group">
                    {{input class="form-control text-right" value=item.privateInsurance }}
                  </div>
                </td>
                <td class="col-xs-1 text-right">{{number-format item.amountOwed}}</td>
                <td class="col-xs-2">
                  {{#if canAddCharge}}
                    <button class="btn btn-default warning" {{action "showDeleteLineItem" item bubbles=false }}>
                      <span class="octicon octicon-x"></span>{{t 'buttons.delete'}}
                    </button>
                  {{/if}}
                </td>
              </tr>
              {{#if item.showDetails}}
                <tr>
                  <th colspan="2" class="col-xs-6">{{t 'labels.name'}}</th>
                  <th class="col-xs-1">{{t 'labels.quantity'}}</th>
                  <th class="col-xs-1">{{t 'labels.price'}}</th>
                  <th class="col-xs-1">{{t 'labels.expenseTo'}}</th>
                  <th class="col-xs-1 text-right">{{t 'labels.total'}}</th>
                  <th class="col-xs-2">
                    {{#if canAddCharge}}
                      <button class="btn btn-primary" {{action "addItemCharge" item}}>
                        <span class="octicon octicon-plus"></span>{{t 'admin.roles.capability.addCharge'}}
                      </button>
                    {{/if}}
                  </th>
                </tr>
                {{#each item.details as |detail|}}
                  <tr>
                    <td colspan="2" class="col-xs-6 input-group">
                      {{input class="form-control" value=detail.name }}
                    </td>
                    <td class="col-xs-1">
                      <div class="form-group">
                        {{input class="form-control" value=detail.quantity }}
                      </div>
                    </td>
                    <td class="col-xs-1">
                      <div class="form-group">
                        {{input class="form-control" value=detail.price }}
                      </div>
                    </td>
                    <td class="col-xs-1">
                      <div class="form-input-group">
                        <select class="language-select form-control" onchange={{action (mut detail.expenseAccount) value="target.value"}}>
                          {{#each expenseAccountList as |account|}}
                            <option value={{account.id}} selected={{eq detail.expenseAccount account.id}}>{{account.value}}</option>
                          {{/each}}
                        </select>
                      </div>
                    </td>
                    <td class="col-xs-1 text-right">
                      {{number-format detail.amountOwed}}
                    </td>
                    <td class="col-xs-2">
                      {{#if canAddCharge}}
                        <button class="btn btn-default warning" {{action "showDeleteItem" detail item.details bubbles=false }}>
                          <span class="octicon octicon-x"></span>{{t 'buttons.delete'}}
                        </button>
                      {{/if}}
                    </td>
                  </tr>
                {{/each}}
              {{/if}}
            {{/each}}
            <tr>
              <td>
                <strong>{{t 'labels.total'}} {{categoryGroup.category}}</strong>
              </td>
              <td class="text-right">{{number-format categoryGroup.total}}</td>
              <td class="text-right">{{number-format categoryGroup.discount}}</td>
{'fraction_non_alphanumeric': 0.16117519597221336, 'fraction_numerical': 0.004971002485501243, 'mean_word_length': 1.5403917759430144, 'pattern_counts': {'":': 0, '<': 271, '<?xml version=': 0, '>': 271, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4487087', 'n_tokens_mistral': 4499, 'n_tokens_neox': 4221, 'n_words': 766}