Skip to content
Snippets Groups Projects
Commit 07ec37de authored by Jared Hancock's avatar Jared Hancock
Browse files

Add all contact information to user lookup popup

Previously only the name, email, and phone number would be displayed on the
pop up dialog
parent 7b853b45
No related branches found
No related tags found
No related merge requests found
<div id="the-lookup-form">
<h3><?php echo $info['title']; ?></h3> <h3><?php echo $info['title']; ?></h3>
<b><a class="close" href="#"><i class="icon-remove-circle"></i></a></b> <b><a class="close" href="#"><i class="icon-remove-circle"></i></a></b>
<hr/> <hr/>
...@@ -17,6 +18,21 @@ if ($info['error']) { ...@@ -17,6 +18,21 @@ if ($info['error']) {
id="unselect-user" href="#"><i class="icon-remove"></i> Add New User</a> id="unselect-user" href="#"><i class="icon-remove"></i> Add New User</a>
<div><strong id="user-name"><?php echo $user ? $user->getName() : ''; ?></strong></div> <div><strong id="user-name"><?php echo $user ? $user->getName() : ''; ?></strong></div>
<div>&lt;<span id="user-email"><?php echo $user ? $user->getEmail() : ''; ?></span>&gt;</div> <div>&lt;<span id="user-email"><?php echo $user ? $user->getEmail() : ''; ?></span>&gt;</div>
<?php if ($user) { ?>
<table style="margin-top: 1em;">
<?php foreach ($user->getDynamicData() as $entry) { ?>
<tr><td colspan="2" style="border-bottom: 1px dotted black"><strong><?php
echo $entry->getForm()->get('title'); ?></strong></td></tr>
<?php foreach ($entry->getAnswers() as $a) { ?>
<tr style="vertical-align:top"><td style="width:30%;border-bottom: 1px dotted #ccc"><?php echo Format::htmlchars($a->getField()->get('label'));
?>:</td>
<td style="border-bottom: 1px dotted #ccc"><?php echo $a->toString(); ?></td>
</tr>
<?php }
}
?>
</table>
<?php } ?>
<div class="clear"></div> <div class="clear"></div>
<hr> <hr>
<p class="full-width"> <p class="full-width">
...@@ -49,6 +65,7 @@ if ($info['error']) { ...@@ -49,6 +65,7 @@ if ($info['error']) {
</form> </form>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('#user-search').typeahead({ $('#user-search').typeahead({
...@@ -62,12 +79,9 @@ $(function() { ...@@ -62,12 +79,9 @@ $(function() {
}); });
}, },
onselect: function (obj) { onselect: function (obj) {
$('#user-name').text(obj.name); $('#the-lookup-form').load(
$('#user-email').text(obj.email); "ajax.php/users/select/"+obj.id
$('#user-id').val(obj.id); );
$('div#selected-user-info').show();
$('div#new-user-form').hide();
$('#user-search').val('');
}, },
property: "/bin/true" property: "/bin/true"
}); });
......
...@@ -22,7 +22,20 @@ if ($info['error']) { ...@@ -22,7 +22,20 @@ if ($info['error']) {
<div><b><a href="#" id="edituser"><i class="icon-edit"></i>&nbsp;<?php <div><b><a href="#" id="edituser"><i class="icon-edit"></i>&nbsp;<?php
echo $user->getName(); ?></a></b></div> echo $user->getName(); ?></a></b></div>
<div>&lt;<?php echo $user->getEmail(); ?>&gt;</div> <div>&lt;<?php echo $user->getEmail(); ?>&gt;</div>
<div><?php echo $user->getPhoneNumber(); ?></div> <table style="margin-top: 1em;">
<?php foreach ($user->getDynamicData() as $entry) {
?>
<tr><td colspan="2" style="border-bottom: 1px dotted black"><strong><?php
echo $entry->getForm()->get('title'); ?></strong></td></tr>
<?php foreach ($entry->getAnswers() as $a) { ?>
<tr style="vertical-align:top"><td style="width:30%;border-bottom: 1px dotted #ccc"><?php echo Format::htmlchars($a->getField()->get('label'));
?>:</td>
<td style="border-bottom: 1px dotted #ccc"><?php echo $a->toString(); ?></td>
</tr>
<?php }
}
?>
</table></div>
<div class="clear"></div> <div class="clear"></div>
<hr> <hr>
<div class="faded">Last updated <b><?php echo Format::db_datetime($user->getUpdateDate()); ?> </b></div> <div class="faded">Last updated <b><?php echo Format::db_datetime($user->getUpdateDate()); ?> </b></div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment