automatic billable calculation (#3200)

This commit is contained in:
Kevin Papst
2022-03-18 22:31:50 +01:00
committed by GitHub
parent f7480902b4
commit 30c7782d6e
34 changed files with 409 additions and 53 deletions

View File

@@ -41,6 +41,14 @@
</td>
</tr>
{% endif %}
{% if not activity.billable %}
<tr>
<th>{{ 'label.billable'|trans }}</th>
<td colspan="3">
{{ widgets.label_boolean(activity.billable) }}
</td>
</tr>
{% endif %}
{% if not activity.global %}
<tr {{ widgets.customer_row_attr(activity.project.customer, now) }}>
<th>{{ 'label.customer'|trans }}</th>

View File

@@ -41,7 +41,14 @@
</div>
</div>
{% endif %}
{{ form_row(form.visible) }}
<div class="row">
<div class="col-md-6">
{{ form_row(form.visible) }}
</div>
<div class="col-md-6">
{{ form_row(form.billable) }}
</div>
</div>
{% if form.metaFields is defined and form.metaFields is not empty %}
{% for meta in form.metaFields|sort((a, b) => a.vars.data.order <=> b.vars.data.order) %}
{{ form_row(meta) }}

View File

@@ -34,6 +34,14 @@
<td>{{ widgets.label_boolean(customer.visible) }}</td>
</tr>
{% endif %}
{% if not customer.billable %}
<tr>
<th>{{ 'label.billable'|trans }}</th>
<td colspan="3">
{{ widgets.label_boolean(customer.billable) }}
</td>
</tr>
{% endif %}
{% if customer.address is not empty %}
<tr>
<th>{{ 'label.address'|trans }}</th>

View File

@@ -80,7 +80,14 @@
</div>
</div>
{% endif %}
{{ form_row(form.visible) }}
<div class="row">
<div class="col-md-6">
{{ form_row(form.visible) }}
</div>
<div class="col-md-6">
{{ form_row(form.billable) }}
</div>
</div>
{% if form.metaFields is defined and form.metaFields is not empty %}
{% for meta in form.metaFields|sort((a, b) => a.vars.data.order <=> b.vars.data.order) %}
{{ form_row(meta) }}

View File

@@ -49,6 +49,14 @@
</td>
</tr>
{% if is_granted('details', project) %}
{% if not project.billable %}
<tr>
<th>{{ 'label.billable'|trans }}</th>
<td colspan="3">
{{ widgets.label_boolean(project.billable) }}
</td>
</tr>
{% endif %}
{% if project.orderNumber is not empty %}
<tr>
<th>{{ 'label.orderNumber'|trans }}</th>

View File

@@ -52,7 +52,14 @@
</div>
</div>
{% endif %}
{{ form_row(form.visible) }}
<div class="row">
<div class="col-md-6">
{{ form_row(form.visible) }}
</div>
<div class="col-md-6">
{{ form_row(form.billable) }}
</div>
</div>
{% if form.metaFields is defined and form.metaFields is not empty %}
{% for meta in form.metaFields|sort((a, b) => a.vars.data.order <=> b.vars.data.order) %}
{{ form_row(meta) }}

View File

@@ -78,14 +78,39 @@
{% endif %}
</div>
{% endif %}
{% if form.fixedRate is defined and form.hourlyRate is defined %}
{% set colWidth = 0 %}
{% if form.fixedRate is defined %}
{% set colWidth = colWidth + 1 %}
{% endif %}
{% if form.hourlyRate is defined %}
{% set colWidth = colWidth + 1 %}
{% endif %}
{% if form.billable is defined %}
{% set colWidth = colWidth + 1 %}
{% elseif form.billableMode is defined %}
{% set colWidth = colWidth + 1 %}
{% endif %}
{% if colWidth > 0 %}
<div class="row">
<div class="col-md-6">
{{ form_row(form.fixedRate, {'row_attr': {'class': 'timesheet_edit_form_row_fixedRate'}}) }}
</div>
<div class="col-md-6">
{{ form_row(form.hourlyRate, {'row_attr': {'class': 'timesheet_edit_form_row_hourlyRate'}}) }}
</div>
{% if form.fixedRate is defined %}
<div class="col-md-{{ 12 / colWidth }}">
{{ form_row(form.fixedRate, {'row_attr': {'class': 'timesheet_edit_form_row_fixedRate'}}) }}
</div>
{% endif %}
{% if form.hourlyRate is defined %}
<div class="col-md-{{ 12 / colWidth }}">
{{ form_row(form.hourlyRate, {'row_attr': {'class': 'timesheet_edit_form_row_hourlyRate'}}) }}
</div>
{% endif %}
{% if form.billable is defined %}
<div class="col-md-{{ 12 / colWidth }}">
{{ form_row(form.billable, {'row_attr': {'class': 'timesheet_edit_form_row_billable'}}) }}
</div>
{% elseif form.billableMode is defined %}
<div class="col-md-{{ 12 / colWidth }}">
{{ form_row(form.billableMode, {'row_attr': {'class': 'timesheet_edit_form_row_billable'}}) }}
</div>
{% endif %}
</div>
{% endif %}
{% if form.metaFields is defined and form.metaFields is not empty %}
@@ -93,19 +118,11 @@
{{ form_row(meta) }}
{% endfor %}
{% endif %}
{% if form.exported is defined or form.billable is defined %}
{% set ebLength = (form.exported is defined and form.billable is defined) ? 6 : 12 %}
{% if form.exported is defined %}
<div class="row">
{% if form.exported is defined %}
<div class="col-md-{{ ebLength }}">
<div class="col-md-12">
{{ form_row(form.exported, {'row_attr': {'class': 'timesheet_edit_form_row_exported'}}) }}
</div>
{% endif %}
{% if form.billable is defined %}
<div class="col-md-{{ ebLength }}">
{{ form_row(form.billable, {'row_attr': {'class': 'timesheet_edit_form_row_billable'}}) }}
</div>
{% endif %}
</div>
{% endif %}
{{ form_widget(form) }}