aboutsummaryrefslogtreecommitdiff
path: root/include/offers-view.php
diff options
context:
space:
mode:
authorCamil Staps2016-07-31 09:40:25 +0200
committerCamil Staps2016-07-31 09:40:25 +0200
commit1ec8d12a7b125d41ecb723c5d83f2afef95408e9 (patch)
tree4d103ccbab48d2217e1ae13d37c229e4060e9184 /include/offers-view.php
parentGive new files a key (diff)
0.5.2 emails
Diffstat (limited to 'include/offers-view.php')
-rw-r--r--include/offers-view.php148
1 files changed, 84 insertions, 64 deletions
diff --git a/include/offers-view.php b/include/offers-view.php
index 802f42f..d96e9ed 100644
--- a/include/offers-view.php
+++ b/include/offers-view.php
@@ -22,70 +22,6 @@ require_once('./login.php');
$_offer = new Offer($_pdo, $_id);
?>
<div class="col-lg-6">
- <div class="panel panel-default" id="panel-timeline">
- <div class="panel-heading">
- <i class="fa fa-clock-o fa-fw"></i> Timeline
- </div>
- <!-- /.panel-heading -->
- <div class="panel-body">
- <ul class="timeline">
- <?php
- $list = array();
- $sort_list = array();
-
- $temp = array(
- 'id' => $_offer->id,
- 'contact' => $_offer->getContact()->name,
- 'assignments' => '',
- 'assignments_header' => ''
- );
- foreach ($_offer->getAssignments() as $assignment) {
- $temp['assignments'] .= "<b>{$assignment->title}</b><br/><span class='smaller'>(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)</span><br/><p>{$assignment->getHTMLDescription()}</p>";
- $temp['assignments_header'] .= "<b>{$assignment->title}</b><br/><span class='smaller'>(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)</span><br/>";
- }
- $list[] = array_merge($temp, array('type' => 'start', 'time' => $_offer->start_date, 'description' => 'Offer started'));
- $sort_list[] = $_offer->start_date . $_offer->id . 0;
- $list[] = array_merge($temp, array('type' => 'end', 'time' => $_offer->end_date, 'description' => 'Offer ended'));
- $sort_list[] = $_offer->end_date . $_offer->id . 1;
- if ($_offer->invoice_date > 0) {
- $list[] = array_merge($temp, array('type' => 'invoice', 'time' => $_offer->invoice_date, 'description' => 'Invoice sent'));
- $sort_list[] = $_offer->invoice_date . $_offer->id . 2;
- if ($_offer->getPaymentReceived() > 0) {
- $list[] = array_merge($temp, array('type' => 'payment_received', 'time' => $_offer->getPaymentReceived(), 'description' => 'Payment received'));
- $sort_list[] = $_offer->getPaymentReceived() . $_offer->id . 3;
- }
- }
-
- array_multisort($sort_list, SORT_DESC, $list);
- $i = 0;
- foreach ($list as $item) {
- if ($item['time'] > time()) {
- continue;
- }
- echo "<li" . ($i++ % 2 == 0 ? ' class="timeline-inverted"' : '') . ">";
- switch ($item['type']) {
- case 'start': echo "<div class='timeline-badge info' title='{$item['description']}'><i class='fa fa-circle-o-notch'></i></div>"; break;
- case 'end': echo "<div class='timeline-badge primary' title='{$item['description']}'><i class='fa fa-circle-o'></i></div>"; break;
- case 'invoice': echo "<div class='timeline-badge warning' title='{$item['description']}'><i class='fa fa-check-circle-o'></i></div>"; break;
- case 'payment_received': echo "<div class='timeline-badge success' title='{$item['description']}'><i class='fa fa-eur'></i></div>"; break;
- }
- echo "<div class='timeline-panel'>";
- echo "<div class='timeline-heading'><h4 class='timeline-title'>#{$item['id']} to {$item['contact']}: {$item['description']}</h4><p><small class='text-muted'><i class='fa fa-clock-o fa-fw'></i> ".BusinessAdmin::formatDate($item['time'],false,true,true)."</small></p></div>";
- switch ($item['type']) {
- case 'start': echo "<div class='timeline-body'>{$item['assignments']}</div>"; break;
- default: echo "<div class='timeline-body'>{$item['assignments_header']}</div>";
- }
- echo "</div>";
- echo "</li>";
- }
- ?>
- </ul>
- </div>
- <!-- /.panel-body -->
- </div>
- <!-- /.panel -->
-</div>
-<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">Assignments</div>
<div class="panel-body table-responsive">
@@ -171,3 +107,87 @@ $_offer = new Offer($_pdo, $_id);
</div>
</div>
</div>
+<div class="clearfix"></div>
+<div class="col-md-6">
+ <div class="panel panel-default">
+ <div class="panel-heading">Tools</div>
+ <div class="panel-body">
+ <?php
+ $accepted = $_offer->accepted ?
+ ['Accepted', 'btn-success'] :
+ ['Not accepted', 'btn-default'];
+ $eligible = $_offer->getPaymentEligibility() ?
+ ['Eligible for online payment', 'btn-success'] :
+ ['Not eligible for online payment', 'btn-default'];
+ ?>
+ <a title='<?=$accepted[0]?>' href='?id=<?=$_offer->id?>&toggle_accept=<?=$_offer->id?>' class='btn <?=$accepted[1]?>'><i class='fa fa-fw fa-check'></i> <?=$accepted[0]?></a>
+ <a title='<?=$eligible[0]?>' href='?id=<?=$_offer->id?>&toggle_payment_eligibility=<?=$_offer->id?>' class='btn <?=$eligible[1]?>'><i class='fa fa-fw fa-credit-card'></i> <?=$eligible[0]?></a>
+ <a title='Send invoice' href='?id=<?=$_offer->id?>&send_invoice=<?=$_offer->id?>' class='btn btn-info'><i class='fa fa-fw fa-envelope'></i> Send invoice to contact</a>
+ <a title='Delete' href='?delete=<?=$_offer->id?>' class='btn btn-danger'><i class='fa fa-fw fa-times'></i> Delete</a>
+ </div>
+ </div>
+</div>
+<div class="col-md-6">
+ <div class="panel panel-default" id="panel-timeline">
+ <div class="panel-heading">
+ <i class="fa fa-clock-o fa-fw"></i> Timeline
+ </div>
+ <!-- /.panel-heading -->
+ <div class="panel-body">
+ <ul class="timeline">
+ <?php
+ $list = array();
+ $sort_list = array();
+
+ $temp = array(
+ 'id' => $_offer->id,
+ 'contact' => $_offer->getContact()->name,
+ 'assignments' => '',
+ 'assignments_header' => ''
+ );
+ foreach ($_offer->getAssignments() as $assignment) {
+ $temp['assignments'] .= "<b>{$assignment->title}</b><br/><span class='smaller'>(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)</span><br/><p>{$assignment->getHTMLDescription()}</p>";
+ $temp['assignments_header'] .= "<b>{$assignment->title}</b><br/><span class='smaller'>(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)</span><br/>";
+ }
+ $list[] = array_merge($temp, array('type' => 'start', 'time' => $_offer->start_date, 'description' => 'Offer started'));
+ $sort_list[] = $_offer->start_date . $_offer->id . 0;
+ $list[] = array_merge($temp, array('type' => 'end', 'time' => $_offer->end_date, 'description' => 'Offer ended'));
+ $sort_list[] = $_offer->end_date . $_offer->id . 1;
+ if ($_offer->invoice_date > 0) {
+ $list[] = array_merge($temp, array('type' => 'invoice', 'time' => $_offer->invoice_date, 'description' => 'Invoice sent'));
+ $sort_list[] = $_offer->invoice_date . $_offer->id . 2;
+ if ($_offer->getPaymentReceived() > 0) {
+ $list[] = array_merge($temp, array('type' => 'payment_received', 'time' => $_offer->getPaymentReceived(), 'description' => 'Payment received'));
+ $sort_list[] = $_offer->getPaymentReceived() . $_offer->id . 3;
+ }
+ }
+
+ array_multisort($sort_list, SORT_DESC, $list);
+ $i = 0;
+ foreach ($list as $item) {
+ if ($item['time'] > time()) {
+ continue;
+ }
+ echo "<li" . ($i++ % 2 == 0 ? ' class="timeline-inverted"' : '') . ">";
+ switch ($item['type']) {
+ case 'start': echo "<div class='timeline-badge info' title='{$item['description']}'><i class='fa fa-circle-o-notch'></i></div>"; break;
+ case 'end': echo "<div class='timeline-badge primary' title='{$item['description']}'><i class='fa fa-circle-o'></i></div>"; break;
+ case 'invoice': echo "<div class='timeline-badge warning' title='{$item['description']}'><i class='fa fa-check-circle-o'></i></div>"; break;
+ case 'payment_received': echo "<div class='timeline-badge success' title='{$item['description']}'><i class='fa fa-eur'></i></div>"; break;
+ }
+ echo "<div class='timeline-panel'>";
+ echo "<div class='timeline-heading'><h4 class='timeline-title'>#{$item['id']} to {$item['contact']}: {$item['description']}</h4><p><small class='text-muted'><i class='fa fa-clock-o fa-fw'></i> ".BusinessAdmin::formatDate($item['time'],false,true,true)."</small></p></div>";
+ switch ($item['type']) {
+ case 'start': echo "<div class='timeline-body'>{$item['assignments']}</div>"; break;
+ default: echo "<div class='timeline-body'>{$item['assignments_header']}</div>";
+ }
+ echo "</div>";
+ echo "</li>";
+ }
+ ?>
+ </ul>
+ </div>
+ <!-- /.panel-body -->
+ </div>
+ <!-- /.panel -->
+</div>