-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_contacts.pdt
97 lines (92 loc) · 6.21 KB
/
client_contacts.pdt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<div class="col-md-12">
<?php echo $this->Html->ifSet($message);?>
<?php
$link_buttons = [
['name' => $this->_('ClientContacts.index.create_contact', true), 'attributes' => ['href' => $this->base_uri . 'contacts/add/']]
];
$this->WidgetClient->clear();
$this->WidgetClient->setLinkButtons($link_buttons);
$this->WidgetClient->create($this->_('ClientContacts.index.boxtitle_contacts', true), ['id' => 'client_contacts'], $this->Html->ifSet($render_section, null));
$this->WidgetClient->startBody();
if ($this->Html->ifSet($contacts, false) && (($num_contacts = count($contacts)) > 0)) {
?>
<div class="table-responsive">
<table class="table table-curved table-striped" id="contacts">
<thead>
<tr>
<th><a href="<?php echo $this->Html->safe($this->base_uri . 'contacts/index/?sort=first_name&order=' . ($sort == 'first_name' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'first_name' ? ' ' . $order : '');?>"><?php $this->_('ClientContacts.index.heading_name');?></a></th>
<th><a href="<?php echo $this->Html->safe($this->base_uri . 'contacts/index/?sort=email&order=' . ($sort == 'email' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'email' ? ' ' . $order : '');?>"><?php $this->_('ClientContacts.index.heading_email');?></a></th>
<th><?php $this->_('ClientContacts.index.heading_type');?></th>
<th><?php $this->_('ClientContacts.index.heading_options');?></th>
</tr>
</thead>
<tbody>
<?php
// Loop through all contacts
for ($i = 0; $i < $num_contacts; $i++) {
?>
<tr>
<td><?php echo $this->Html->concat(' ', $this->Html->_($contacts[$i]->first_name, true), $this->Html->_($contacts[$i]->last_name, true));?></td>
<td><?php $this->Html->_($contacts[$i]->email);?></td>
<td>
<?php
// Set the contact type
$contact_type = $this->Html->ifSet($contact_types[$contacts[$i]->contact_type]);
if ($this->Html->ifSet($contacts[$i]->contact_type) == 'other') {
$contact_type = $this->Html->ifSet($contact_types[$contacts[$i]->contact_type_id]);
}
$this->Html->_($contact_type);
?>
</td>
<td>
<?php
$this->Form->create($this->base_uri . 'contacts/delete/');
$this->Form->fieldHidden('id', $this->Html->ifSet($contacts[$i]->id));
?>
<div class="btn-group">
<a href="<?php echo $this->Html->safe($this->base_uri . 'contacts/edit/' . $this->Html->_($contacts[$i]->id, true) . '/');?>" class="btn btn-xs btn-light">
<i class="fas fa-edit fa-fw"></i> <?php $this->_('ClientContacts.index.option_edit');?>
</a>
<button class="btn btn-xs btn-light dropdown-toggle" data-toggle="dropdown" type="button">
<span class="caret"></span>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="<?php echo $this->Html->safe($this->base_uri . 'contacts/delete/' . $this->Html->_($contacts[$i]->id, true) . '/');?>" rel="<?php echo $this->Html->safe($this->_('ClientContacts.index.confirm_delete', true));?>">
<i class="fas fa-trash fa-fw"></i> <?php $this->_('ClientContacts.index.option_delete');?>
</a>
</div>
</div>
<?php
$this->Form->end();
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
} else {
?>
<div class="alert alert-info">
<p><?php $this->_('ClientContacts.index.no_results');?></p>
</div>
<?php
}
$this->WidgetClient->endBody();
$this->WidgetClient->end();
?>
</div>
<?php
$this->Javascript->setInline("
$(document).ready(function() {
// Handle confirmation on delete action
$('#client_contacts a[rel]').blestaModalConfirm({
base_url: '" . $this->base_uri . "',
submit: true
});
});
");
?>