<commit_before><div class="headertron pattern" style="background-color: #{{@group.color}};">
  <div class="container">
    <h2><a href="/group/{{@group.id}}" style="color: white">Group <b>{{@group.name}}</b></a></h2>

    <p>Created at {{@group.created_at}}</p>
  </div>
</div>

<div class=container>
  <h3>Edit Expense</h3>
  <form action='/group/{{@group.id}}/expenses/{{@expense.id}}' method='post'>
    <input type='hidden' name='csrf_token' value='{{ @SESSION.csrf }}'>
    <input type='hidden' name='amount_float' value='YES'>

    <div class="form-group"><label for="description">Description:</label>
    <input class="form-control" type="text" name="description" value="{{@expense.description}}" id="description"></div>

    <div class="form-group"><label for="amount">Amount:</label>
    <input class="form-control" style="max-width:200px;" type="number" step="0.01" required name="amount" value="{{sprintf('%0.02F',@expense.amount/100)}}" id="amount"></div>

    <div class="form-group"><label for="who_paid">Who Paid:</label>
    <select  class="form-control" style="max-width:200px" required class="memberselect" id="who_paid" name="who_paid">
    <repeat group="{{@members}}" value="{{@d}}">
    <option value="{{@d.member_id}}" {{ @d.member_id==@expense.who_paid ? 'selected':'' }}>{{@d.display_name}}</option>
    </repeat>
    </select></div>

    <div class="form-group"><label for="date">Date:</label>
    <input class="form-control" style="max-width:200px;" type="date" required name="date" value="{{@expense.date}}" id="date"></div>

    <table class=table>
    <repeat group="{{@splits}}" value="{{@d}}">
      <tr>
        <td>{{ @d.display_name }}</td>
        <td><input type="number" step="0.01" required name="split[{{@d.member_id}}]" value="{{sprintf('%0.02F',@d.amount/100)}}"></td>
      </tr>
    </repeat>
    </table>

    <div class="form-group"><input class="btn" type="submit" value="OK"></div>

  </form>
</div><commit_msg>show sum on editing expense if it doesn't match the amount<commit_after><div class="headertron pattern" style="background-color: #{{@group.color}};">
  <div class="container">
    <h2><a href="/group/{{@group.id}}" style="color: white">Group <b>{{@group.name}}</b></a></h2>

    <p>Created at {{@group.created_at}}</p>
  </div>
</div>

<div class=container>
  <h3>Edit Expense</h3>
  <form action='/group/{{@group.id}}/expenses/{{@expense.id}}' method='post'>
    <input type='hidden' name='csrf_token' value='{{ @SESSION.csrf }}'>
    <input type='hidden' name='amount_float' value='YES'>

    <div class="form-group"><label for="description">Description:</label>
    <input class="form-control" type="text" name="description" value="{{@expense.description}}" id="description"></div>

    <div class="form-group"><label for="amount">Amount:</label>
    <input class="form-control" style="max-width:200px;" type="number" step="0.01" required name="amount" value="{{sprintf('%0.02F',@expense.amount/100)}}" id="amount"></div>

    <div class="form-group"><label for="who_paid">Who Paid:</label>
    <select  class="form-control" style="max-width:200px" required class="memberselect" id="who_paid" name="who_paid">
    <repeat group="{{@members}}" value="{{@d}}">
    <option value="{{@d.member_id}}" {{ @d.member_id==@expense.who_paid ? 'selected':'' }}>{{@d.display_name}}</option>
    </repeat>
    </select></div>

    <div class="form-group"><label for="date">Date:</label>
    <input class="form-control" style="max-width:200px;" type="date" required name="date" value="{{@expense.date}}" id="date"></div>

    <table class=table>
    <repeat group="{{@splits}}" value="{{@d}}">
      <tr>
        <td>{{ @d.display_name }}</td>
        <td><input type="number" step="0.01" required name="split[{{@d.member_id}}]" value="{{sprintf('%0.02F',@d.amount/100)}}" class="expense_inputs"></td>
      </tr>
    </repeat>
	<tr style="display: none" id="expense_sum"><td>Sum</td><td><span></span></td></tr>
    </table>

    <div class="form-group"><input class="btn" type="submit" value="OK"></div>

  </form>
</div>
<script>
$(".expense_inputs, #amount").change(function() {
	var sum = 0;
	$(".expense_inputs").each(function() {
		sum += parseFloat($(this).val());
	});
	$("#expense_sum span").text(sum.toFixed(2));
	$("#expense_sum").toggle(sum != parseFloat($("#amount").val()))
});
</script>
{'fraction_non_alphanumeric': 0.2552310876063463, 'fraction_numerical': 0.014716026672798345, 'mean_word_length': 5.350364963503649, 'pattern_counts': {'":': 0, '<': 131, '<?xml version=': 0, '>': 131, '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': '6916144', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1490, 'n_words': 250}