Skip to content

Commit 466da74

Browse files
Merge pull request #35 from zhil/master
Entity refactoring
2 parents 4c2fda0 + 3203893 commit 466da74

63 files changed

Lines changed: 5063 additions & 2747 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: php
22
php:
3-
- 5.6
3+
- 7.0
44

55
before_script:
66
- composer install

app/AppKernel.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public function registerBundles()
2626
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
2727
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
2828
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
29+
$bundles[] = new Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle();
30+
$bundles[] = new Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle();
31+
$bundles[] = new Hautelook\AliceBundle\HautelookAliceBundle();
2932
}
3033

3134
return $bundles;

app/Resources/views/base.html.twig

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
{% import ":other:macro.html.twig" as macro %}
2+
3+
14
<!DOCTYPE html>
25
<html>
36
<head>
@@ -15,7 +18,7 @@
1518
<div class="aui-header-inner">
1619
<ul class="aui-nav">
1720
<li><a href="{{ url('dashboard') }}">Dashboard</a></li>
18-
<li><a href="{{ url('sales') }}">Sales</a></li>
21+
<li><a href="{{ url('transactions') }}">Transactions</a></li>
1922
<li><a href="{{ url('licenses') }}">Licenses</a></li>
2023
</ul>
2124
</div>
@@ -32,7 +35,21 @@
3235
<div class="aui-page-panel">
3336
<div class="aui-page-panel-inner">
3437
<section class="aui-page-panel-content">
38+
{% if __STATUS.getCrontabProblems() | length %}
39+
{{ macro.message("Possible problems with cron!",__STATUS.getCrontabProblems() | join("<br>"),"error") }}
40+
{% endif %}
41+
{% if __STATUS.getCrontabSetupInstructions() | length %}
42+
{{ macro.message("Please setup on crontab for daily execution",__STATUS.getCrontabSetupInstructions() | join("<br>"),"warning") }}
43+
{% endif %}
44+
{% if __STATUS.getStatusEntity().getLicenseImportException() or __STATUS.getStatusEntity().getTransactionImportException() %}
45+
{{ macro.message("Got system error, please contact developer",__STATUS.getStatusEntity().getLicenseImportException()~" <BR>"~__STATUS.getStatusEntity().getTransactionImportException(),"error") }}
46+
{% endif %}
47+
{% if __STATUS.getStatusEntity().availableUpdates %}
48+
{{ macro.message("Updates available, <a href='https://github.com/thecatontheflat/atlassian-vendor-tools/'>more info</a>",__STATUS.getStatusEntity().availableUpdates,"success") }}
49+
{% endif %}
50+
3551
{% block content %}
52+
3653
{% endblock %}
3754
</section>
3855
</div>
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{% extends '::base.html.twig' %}
2+
3+
{% block content %}
4+
{# @var company AppBundle\Entity\Company #}
5+
<h2>Company Details</h2>
6+
<table class="aui">
7+
<tbody>
8+
<tr>
9+
<td><h6>SEN</h6></td>
10+
<td>{{ company.senId }}</td>
11+
</tr>
12+
<tr>
13+
<td><h6>Company</h6></td>
14+
<td>{{ company.company }}</td>
15+
</tr>
16+
<tr>
17+
<td><h6>TECHNICAL CONTACT</h6></td>
18+
<td>
19+
{{ company.technicalContactName }} <br/>
20+
{{ company.technicalContactEmail }}
21+
</td>
22+
</tr>
23+
<tr>
24+
<td><h6>BILLING CONTACT</h6></td>
25+
<td>
26+
{{ company.billingContactName }} <br/>
27+
{{ company.billingContactEmail }}
28+
</td>
29+
</tr>
30+
<tr>
31+
<td><h6>TOTAL EARNINGS</h6></td>
32+
<td>
33+
${{ company.getTotalVendorAmount() }}
34+
</td>
35+
</tr>
36+
{# <tr>
37+
<td><h6>RELATED ISSUES</h6></td>
38+
<td>
39+
TODO: Add custom property SEN to Jira issue tracker, link issues from this company on this page?
40+
</td>
41+
</tr> #}
42+
</tbody>
43+
</table>
44+
<h2>Licenses</h2>
45+
{% for license in company.licenses %}
46+
<div class="aui-group">
47+
<div class="aui-item">
48+
<h3>{{ license.addon.addonName }}({{ license.addon.addonKey }})</h3>
49+
<table class="aui">
50+
<tbody>
51+
<tr>
52+
<td><h6>LICENSE ID</h6></td>
53+
<td>{{ license.addonLicenseId }}</td>
54+
</tr>
55+
56+
57+
<tr>
58+
<td><h6>LICENSE TYPE</h6></td>
59+
<td>{{ license.licenseType }}</td>
60+
</tr>
61+
62+
<tr>
63+
<td><h6>START DATE</h6></td>
64+
<td>{{ license.maintenanceStartDate|date('Y-m-d') }}</td>
65+
</tr>
66+
67+
<tr>
68+
<td><h6>END DATE</h6></td>
69+
<td>{{ license.maintenanceEndDate|date('Y-m-d') }}</td>
70+
</tr>
71+
{# add days left
72+
<tr>
73+
<td><h6>Days left</h6></td>
74+
<td>{{ 'now'|time_diff(license.maintenanceEndDate) }}</td>
75+
</tr>
76+
#}
77+
78+
<tr>
79+
<td><h6>RENEWAL ACTION</h6></td>
80+
<td>{{ license.renewalAction }}</td>
81+
</tr>
82+
<tr>
83+
<td><h6>Transactions</h6></td>
84+
<td>
85+
{% if license.transactions | length %}
86+
<div class="aui-group">
87+
<div class="aui-item">
88+
<table class="aui">
89+
{% for transaction in license.transactions %}
90+
<tr>
91+
<td><a href="{{ path('transaction_detail', {'transactionId': transaction.transactionId}) }}">{{ transaction.transactionId }}</a></td>
92+
<td>{{ transaction.saleDate|date('Y-m-d') }}</td>
93+
<td>${{ transaction.vendorAmount }}</td>
94+
<td>{{ transaction.license.addon.addonName }}</td>
95+
<td>{{ transaction.tier}}</td>
96+
</tr>
97+
{% endfor %}
98+
<tr>
99+
<td><strong>Total:</strong></td>
100+
<td><strong>${{ license.getTotalVendorAmount() }}</strong></td>
101+
<td></td>
102+
<td></td>
103+
<td></td>
104+
</tr>
105+
</table>
106+
</div>
107+
</div>
108+
{% else %}
109+
None
110+
{% endif %}
111+
</td>
112+
</tr>
113+
</tbody>
114+
</table>
115+
</div>
116+
</div>
117+
{% endfor %}
118+
119+
{% endblock %}

app/Resources/views/dashboard/index.html.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<h2>Expiring Soon</h2>
1414
<div class="aui-group">
1515
<div class="aui-item" id="expiring-soon">
16-
{% include ':other:license_table.html.twig' with {'licenses': expiringSoon, 'expiringSoonSales': expiringSoonSales} %}
16+
{% include ':other:license_table.html.twig' with {'licenses': expiringSoon} %}
1717
</div>
1818
</div>
1919

@@ -29,11 +29,11 @@
2929
<div class="aui-group">
3030
<div class="aui-item" id="top-customers">
3131
<table class="aui">
32-
{% for customer in topCustomers %}
32+
{% for statsRow in topLicenses %}
3333
<tr>
34-
<td>{{ macro.licenseUrl(customer.licenseId) }}</td>
35-
<td>{{ customer.organisationName }}</td>
36-
<td><strong>${{ customer.total }}</strong></td>
34+
<td>{{ macro.companyUrl(statsRow[0].company.senId) }}</td>
35+
<td>{{ statsRow[0].company.company }}</td>
36+
<td><strong>${{ statsRow.total }}</strong></td>
3737
</tr>
3838
{% endfor %}
3939
</table>

app/Resources/views/license/detail.html.twig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@
1515

1616
<tr>
1717
<td><h6>ORGANISATION NAME</h6></td>
18-
<td>{{ license.organisationName }}</td>
18+
<td>{{ license.company.company }}</td>
1919
</tr>
2020

2121
<tr>
2222
<td><h6>ADDON</h6></td>
23-
<td>{{ license.addonName }} ({{ license.addonKey }})</td>
23+
<td>{{ license.addon.addonName }} ({{ license.addon.addonKey }})</td>
2424
</tr>
2525

2626
<tr>
2727
<td><h6>TECHNICAL CONTACT</h6></td>
2828
<td>
29-
{{ license.techContactName }} <br/>
30-
{{ license.techContactEmail }}
29+
{{ license.company.technicalContactName }} <br/>
30+
{{ license.company.technicalContactEmail }}
3131
</td>
3232
</tr>
3333

3434
<tr>
3535
<td><h6>BILLING CONTACT</h6></td>
3636
<td>
37-
{{ license.billingContactName }} <br/>
38-
{{ license.billingContactEmail }}
37+
{{ license.company.billingContactName }} <br/>
38+
{{ license.company.billingContactEmail }}
3939
</td>
4040
</tr>
4141

@@ -51,12 +51,12 @@
5151

5252
<tr>
5353
<td><h6>START DATE</h6></td>
54-
<td>{{ license.startDate|date('Y-m-d') }}</td>
54+
<td>{{ license.maintenanceStartDate|date('Y-m-d') }}</td>
5555
</tr>
5656

5757
<tr>
5858
<td><h6>END DATE</h6></td>
59-
<td>{{ license.endDate|date('Y-m-d') }}</td>
59+
<td>{{ license.maintenanceEndDate|date('Y-m-d') }}</td>
6060
</tr>
6161

6262
<tr>

app/Resources/views/other/aui_form_theme.html.twig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
{# Labels #}
203203

204204
{%- block form_label -%}
205-
{% if label is not sameas(false) -%}
205+
{% if label is not same as(false) -%}
206206
{% if not compound -%}
207207
{% set label_attr = label_attr|merge({'for': id}) %}
208208
{%- endif %}
@@ -320,9 +320,9 @@
320320
{{- " " -}}
321321
{%- if attrname in ['placeholder', 'title'] -%}
322322
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
323-
{%- elseif attrvalue is sameas(true) -%}
323+
{%- elseif attrvalue is same as(true) -%}
324324
{{- attrname }}="{{ attrname }}"
325-
{%- elseif attrvalue is not sameas(false) -%}
325+
{%- elseif attrvalue is not same as(false) -%}
326326
{{- attrname }}="{{ attrvalue }}"
327327
{%- endif -%}
328328
{%- endfor -%}
@@ -334,9 +334,9 @@
334334
{{- " " -}}
335335
{%- if attrname in ['placeholder', 'title'] -%}
336336
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
337-
{%- elseif attrvalue is sameas(true) -%}
337+
{%- elseif attrvalue is same as(true) -%}
338338
{{- attrname }}="{{ attrname }}"
339-
{%- elseif attrvalue is not sameas(false) -%}
339+
{%- elseif attrvalue is not same as(false) -%}
340340
{{- attrname }}="{{ attrvalue }}"
341341
{%- endif -%}
342342
{%- endfor -%}
@@ -348,9 +348,9 @@
348348
{{- " " -}}
349349
{%- if attrname in ['placeholder', 'title'] -%}
350350
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
351-
{%- elseif attrvalue is sameas(true) -%}
351+
{%- elseif attrvalue is same as(true) -%}
352352
{{- attrname }}="{{ attrname }}"
353-
{%- elseif attrvalue is not sameas(false) -%}
353+
{%- elseif attrvalue is not same as(false) -%}
354354
{{- attrname }}="{{ attrvalue }}"
355355
{%- endif -%}
356356
{%- endfor -%}

app/Resources/views/other/license_table.html.twig

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<thead>
66
<tr>
77
{% if licenses.template|default(false) %}
8-
<th><h6>{{ knp_pagination_sortable(licenses, 'id', 'l.id') }}</h6></th>
9-
<th><h6>{{ knp_pagination_sortable(licenses, 'organisation', 'l.organisationName') }}</h6></th>
10-
<th><h6>{{ knp_pagination_sortable(licenses, 'addon', 'l.addonName') }}</h6></th>
8+
<th><h6>{{ knp_pagination_sortable(licenses, 'id', 'l.senId') }}</h6></th>
9+
<th><h6>{{ knp_pagination_sortable(licenses, 'organisation', 'company.company') }}</h6></th>
10+
<th><h6>{{ knp_pagination_sortable(licenses, 'addon', 'addon.addonName') }}</h6></th>
1111
<th><h6>{{ knp_pagination_sortable(licenses, 'type', 'l.licenseType') }}</h6></th>
12-
<th><h6>{{ knp_pagination_sortable(licenses, 'start date', 'l.startDate') }}</h6></th>
13-
<th><h6>{{ knp_pagination_sortable(licenses, 'end date', 'l.endDate') }}</h6></th>
12+
<th><h6>{{ knp_pagination_sortable(licenses, 'start date', 'l.maintenanceStartDate') }}</h6></th>
13+
<th><h6>{{ knp_pagination_sortable(licenses, 'end date', 'l.maintenanceEndDate') }}</h6></th>
1414
{% else %}
1515
<th><h6>id</h6></th>
1616
<th><h6>organisation</h6></th>
@@ -24,23 +24,23 @@
2424
<tbody>
2525
{% for license in licenses %}
2626
<tr>
27-
<td>{{ macro.licenseUrl(license.licenseId) }}</td>
27+
<td>{{ macro.companyUrl(license.company.senId) }}</td>
2828
<td>
29-
{{ license.organisationName }}
29+
{{ license.company.company }}
3030
{% if license.renewalAction == 'AUTO_QUOTE' %}
3131
<span class="aui-lozenge aui-lozenge-current">quote</span>
3232
{% endif %}
3333
</td>
34-
<td>{{ license.addonName }}</td>
34+
<td>{{ license.addon.addonName }}</td>
3535
<td>
3636
{{ license.licenseType }}
37-
{% set key = license.licenseId ~ license.addonKey %}
38-
{% if expiringSoonSales[key]|default(false) %}
39-
<span class="aui-lozenge aui-lozenge-success aui-lozenge-subtle">${{ expiringSoonSales[key].vendorAmount }}</span>
37+
{% set lastTransaction = license.getLastTransaction() %}
38+
{% if lastTransaction %}
39+
<span class="aui-lozenge aui-lozenge-success aui-lozenge-subtle">${{ lastTransaction.vendorAmount }}</span>
4040
{% endif %}
4141
</td>
42-
<td>{{ license.startDate|date('Y-m-d') }}</td>
43-
<td>{{ license.endDate|date('Y-m-d') }}</td>
42+
<td>{{ license.maintenanceStartDate|date('Y-m-d') }}</td>
43+
<td>{{ license.maintenanceEndDate|date('Y-m-d') }}</td>
4444
</tr>
4545
{% endfor %}
4646
</tbody>
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1-
{% macro licenseUrl(licenseId) %}
2-
<a href="{{ url('license_detail', {'licenseId': licenseId}) }}">{{ licenseId }}</a>
1+
{% macro companyUrl(senId) %}
2+
<a href="{{ url('company_detail', {'senId': senId}) }}">{{ senId }}</a>
3+
{% endmacro %}
4+
{% macro message(title, body, type) %}
5+
<div class="aui-message aui-message-{{ type }}">
6+
<p class="title">
7+
<strong>{{ title | raw }}</strong>
8+
</p>
9+
<p>{{ body | raw }}</p>
10+
</div>
311
{% endmacro %}

app/Resources/views/other/sale_table.html.twig

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)