<commit_before>{% extends 'timepiece/time-sheet/base.html' %}
{% load timepiece_tags math_tags %}

{% block title %}Timepiece Entries{% endblock %}

{% block css %}{{ block.super }}
    <link charset='UTF-8' rel="stylesheet" type="text/css" media="screen" href="{{ STATIC_URL }}css/bar-graph.css" />
    <link charset='UTF-8' rel="stylesheet" type="text/css" media="screen" href="{{ STATIC_URL }}jqplot/jquery.jqplot.min.css" />
{% endblock %}

{% block javascript %}{{ block.super }}
    <script type="text/javascript" src="{{ STATIC_URL }}jqplot/jquery.jqplot.min.js"></script>
    <script type="text/javascript" src="{{ STATIC_URL }}jqplot/plugins/jqplot.pieRenderer.min.js"></script>
    <script type="text/javascript">
        ;(function($) {
            $.fn.textfill = function(options) {
                $(this).each(function() {
                    var fontSize = options.maxFontPixels;
                    var ourText = $('span:visible:first', this);
                    var maxHeight = $(this).height();
                    var maxWidth = $(this).width();
                    var textHeight;
                    var textWidth;
                    do {
                        ourText.css('font-size', fontSize);
                        textHeight = ourText.height();
                        textWidth = ourText.width();
                        fontSize = fontSize - 1;
                    } while ((textHeight > maxHeight || textWidth > maxWidth) && fontSize > 3);
                    return this;
                });
            }
        })(jQuery);

        jQuery(document).ready(function($) {
            $('div.bar-graph-start').textfill({ maxFontPixels: 13 });
            $('div.bar-graph-end').textfill({ maxFontPixels: 13 });
            $('div.bar-graph-over').textfill({ maxFontPixels: 13 });
            $.jqplot.config.enablePlugins = true; // on the page before plot creation.
            week_totals = [
                {% for assignment in allocations %}
                    ["{{ assignment.assignment.contract.project }}", {{ assignment.hours }}],
                {% endfor %}
            ];
            if (week_totals.length > 0) {
                plot1 = $.jqplot('my-weekly-hours-chart', [week_totals], {
                    title: '',
                    seriesDefaults:{renderer:$.jqplot.PieRenderer, rendererOptions:{sliceMargin:2}},
                    legend:{show:true},
                    grid:{shadow:false, borderWidth:0.0}
                });
            }
        });
    </script>
{% endblock %}

{% block content %}
<h2>My Time Sheet</h2>
<ul class='header-actions-left'>
    <li><a href="{% url timepiece-clock-in %}">Clock In</a></li>
    <li><a href="{% url timepiece-add %}">Add Entry</a></li>
</ul>
<h3>My Projects</h3>
<table class='my-projects'>
	<tr><th>Project</th><th>My Hours</th><th>Hours Worked</th><th>Hours Remaining</th><th>Due Date</th><th></th></tr>
	{% regroup assignments by contract.project.type as type_list %}
	{% for type in type_list %}
	<tr><th colspan='6'>{{ type.grouper }}s</th></tr>
	{% for assignment in type.list %}
	<tr>
	   <td><a href="{% url timepiece-clock-in %}?project={{ assignment.contract.project.pk }}">{{ assignment.contract.project }}</a></td>
       <td class='hours'>{{ assignment.num_hours }}</td>
       <td class='hours'>{{ assignment.hours_worked|floatformat:2 }} ({% widthratio assignment.hours_worked assignment.num_hours 100 %}%)</td>
       <td class='hours'>{{ assignment.hours_remaining|floatformat:2 }}</td>
       <td>{{ assignment.end_date }}</td>
       <td>
			<ul class='actions'>
			    <li><a href="{% url timepiece-add %}?project={{ assignment.contract.project.pk }}">Add Entry</a></li>
			</ul>
       </td>
	</tr>
	{% endfor %}
	{% endfor %}
</table>

<h3>
    {% with entries.count as num_entries %}
        My Active Entries
    {% endwith %}
</h3>

{% with my_active_entries as entries %}
{% include 'timepiece/time-sheet/_entry_list.html' %}
{% endwith %}

{% if allocations or project_entries %}
  <h3>My Work This Week</h3>
  <table class='my-week'>
	  <tr><th>Project</th><th>Hours Worked</th></tr>
      {% for assignment in allocations %}
          <tr>
          <td>
            <a href="{% url timepiece-clock-in %}?project={{ assignment.assignment.contract.project.pk }}">
                {{ assignment.assignment.contract.project }}
            </a>
          </td>
          <td class='hours'>
              {% bar_graph assignment.assignment.contract.project assignment.hours_worked assignment.hours %}
          </td>
	    </tr>
      {% endfor %}
	  {% for entry in project_entries %}
        <tr>
            <td>
                <a href="{% url timepiece-clock-in %}?project={{ entry.project__pk }}">
                    {{ entry.project__name }}
                </a>
            </td>
            <td>{{ entry.sum }}</td>
        </tr>
      {% endfor %}
      {% ifnotequal schedule.count 0 %}
      {% for row in activity_entries %}
        <tr>
            <th>Total {% if row.billable %}billable{% else %}non-billable{% endif %} time:</th>
            <td>
                {% if row.billable %}
                    {% bar_graph '' row.sum schedule.0.hours_per_week %}
                {% else %}
                    {{ row.sum }}<commit_msg>fixed invoicing billable template<commit_after>{% extends 'timepiece/time-sheet/base.html' %}
{% load timepiece_tags math_tags %}

{% block title %}Timepiece Entries{% endblock %}

{% block css %}{{ block.super }}
    <link charset='UTF-8' rel="stylesheet" type="text/css" media="screen" href="{{ STATIC_URL }}css/bar-graph.css" />
    <link charset='UTF-8' rel="stylesheet" type="text/css" media="screen" href="{{ STATIC_URL }}jqplot/jquery.jqplot.min.css" />
{% endblock %}

{% block javascript %}{{ block.super }}
    <script type="text/javascript" src="{{ STATIC_URL }}jqplot/jquery.jqplot.min.js"></script>
    <script type="text/javascript" src="{{ STATIC_URL }}jqplot/plugins/jqplot.pieRenderer.min.js"></script>
    <script type="text/javascript">
        ;(function($) {
            $.fn.textfill = function(options) {
                $(this).each(function() {
                    var fontSize = options.maxFontPixels;
                    var ourText = $('span:visible:first', this);
                    var maxHeight = $(this).height();
                    var maxWidth = $(this).width();
                    var textHeight;
                    var textWidth;
                    do {
                        ourText.css('font-size', fontSize);
                        textHeight = ourText.height();
                        textWidth = ourText.width();
                        fontSize = fontSize - 1;
                    } while ((textHeight > maxHeight || textWidth > maxWidth) && fontSize > 3);
                    return this;
                });
            }
        })(jQuery);

        jQuery(document).ready(function($) {
            $('div.bar-graph-start').textfill({ maxFontPixels: 13 });
            $('div.bar-graph-end').textfill({ maxFontPixels: 13 });
            $('div.bar-graph-over').textfill({ maxFontPixels: 13 });
            $.jqplot.config.enablePlugins = true; // on the page before plot creation.
            week_totals = [
                {% for assignment in allocations %}
                    ["{{ assignment.assignment.contract.project }}", {{ assignment.hours }}],
                {% endfor %}
            ];
            if (week_totals.length > 0) {
                plot1 = $.jqplot('my-weekly-hours-chart', [week_totals], {
                    title: '',
                    seriesDefaults:{renderer:$.jqplot.PieRenderer, rendererOptions:{sliceMargin:2}},
                    legend:{show:true},
                    grid:{shadow:false, borderWidth:0.0}
                });
            }
        });
    </script>
{% endblock %}

{% block content %}
<h2>My Time Sheet</h2>
<ul class='header-actions-left'>
    <li><a href="{% url timepiece-clock-in %}">Clock In</a></li>
    <li><a href="{% url timepiece-add %}">Add Entry</a></li>
</ul>
<h3>My Projects</h3>
<table class='my-projects'>
	<tr><th>Project</th><th>My Hours</th><th>Hours Worked</th><th>Hours Remaining</th><th>Due Date</th><th></th></tr>
	{% regroup assignments by contract.project.type as type_list %}
	{% for type in type_list %}
	<tr><th colspan='6'>{{ type.grouper }}s</th></tr>
	{% for assignment in type.list %}
	<tr>
	   <td><a href="{% url timepiece-clock-in %}?project={{ assignment.contract.project.pk }}">{{ assignment.contract.project }}</a></td>
       <td class='hours'>{{ assignment.num_hours }}</td>
       <td class='hours'>{{ assignment.hours_worked|floatformat:2 }} ({% widthratio assignment.hours_worked assignment.num_hours 100 %}%)</td>
       <td class='hours'>{{ assignment.hours_remaining|floatformat:2 }}</td>
       <td>{{ assignment.end_date }}</td>
       <td>
			<ul class='actions'>
			    <li><a href="{% url timepiece-add %}?project={{ assignment.contract.project.pk }}">Add Entry</a></li>
			</ul>
       </td>
	</tr>
	{% endfor %}
	{% endfor %}
</table>

<h3>
    {% with entries.count as num_entries %}
        My Active Entries
    {% endwith %}
</h3>

{% with my_active_entries as entries %}
{% include 'timepiece/time-sheet/_entry_list.html' %}
{% endwith %}

{% if allocations or project_entries %}
  <h3>My Work This Week</h3>
  <table class='my-week'>
	  <tr><th>Project</th><th>Hours Worked</th></tr>
      {% for assignment in allocations %}
          <tr>
          <td>
            <a href="{% url timepiece-clock-in %}?project={{ assignment.assignment.contract.project.pk }}">
                {{ assignment.assignment.contract.project }}
            </a>
          </td>
          <td class='hours'>
              {% bar_graph assignment.assignment.contract.project assignment.hours_worked assignment.hours %}
          </td>
	    </tr>
      {% endfor %}
	  {% for entry in project_entries %}
        <tr>
            <td>
                <a href="{% url timepiece-clock-in %}?project={{ entry.project__pk }}">
                    {{ entry.project__name }}
                </a>
            </td>
            <td>{{ entry.sum }}</td>
        </tr>
      {% endfor %}
      {% ifnotequal schedule.count 0 %}
      {% for row in activity_entries %}
        <tr>
            <th>Total {% if row.activity__billable %}billable{% else %}non-billable{% endif %} time:</th>
            <td>
                {% if row.activity__billable %}
                    {% bar_graph '' row.sum schedule.0.hours_per_week %}
                {% else %}
                    {{ row.sum }}
{'fraction_non_alphanumeric': 0.17452830188679244, 'fraction_numerical': 0.005849056603773585, 'mean_word_length': 2.079895409645555, 'pattern_counts': {'":': 0, '<': 193, '<?xml version=': 0, '>': 201, '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': '3398453', 'n_tokens_mistral': 3453, 'n_tokens_neox': 3095, 'n_words': 635}