From 07ec37ded9c515c6cc2fd1766bdc4869659ccf86 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 11 Dec 2013 14:04:24 -0600 Subject: [PATCH] Add all contact information to user lookup popup Previously only the name, email, and phone number would be displayed on the pop up dialog --- include/staff/templates/user-lookup.tmpl.php | 26 +++++++++++++++----- include/staff/templates/user.tmpl.php | 15 ++++++++++- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/include/staff/templates/user-lookup.tmpl.php b/include/staff/templates/user-lookup.tmpl.php index de8dedb4e..74508a023 100644 --- a/include/staff/templates/user-lookup.tmpl.php +++ b/include/staff/templates/user-lookup.tmpl.php @@ -1,3 +1,4 @@ +<div id="the-lookup-form"> <h3><?php echo $info['title']; ?></h3> <b><a class="close" href="#"><i class="icon-remove-circle"></i></a></b> <hr/> @@ -17,6 +18,21 @@ if ($info['error']) { 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><<span id="user-email"><?php echo $user ? $user->getEmail() : ''; ?></span>></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> <hr> <p class="full-width"> @@ -49,6 +65,7 @@ if ($info['error']) { </form> </div> <div class="clear"></div> +</div> <script type="text/javascript"> $(function() { $('#user-search').typeahead({ @@ -62,12 +79,9 @@ $(function() { }); }, onselect: function (obj) { - $('#user-name').text(obj.name); - $('#user-email').text(obj.email); - $('#user-id').val(obj.id); - $('div#selected-user-info').show(); - $('div#new-user-form').hide(); - $('#user-search').val(''); + $('#the-lookup-form').load( + "ajax.php/users/select/"+obj.id + ); }, property: "/bin/true" }); diff --git a/include/staff/templates/user.tmpl.php b/include/staff/templates/user.tmpl.php index 43176c796..aaf0cdedb 100644 --- a/include/staff/templates/user.tmpl.php +++ b/include/staff/templates/user.tmpl.php @@ -22,7 +22,20 @@ if ($info['error']) { <div><b><a href="#" id="edituser"><i class="icon-edit"></i> <?php echo $user->getName(); ?></a></b></div> <div><<?php echo $user->getEmail(); ?>></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> <hr> <div class="faded">Last updated <b><?php echo Format::db_datetime($user->getUpdateDate()); ?> </b></div> -- GitLab