Skip to content
Snippets Groups Projects
Commit f493d9a5 authored by Peter Rotich's avatar Peter Rotich
Browse files

Use the new user modal dialog

parent 3ea63b04
No related branches found
No related tags found
No related merge requests found
...@@ -67,28 +67,9 @@ if($ticket->isOverdue()) ...@@ -67,28 +67,9 @@ if($ticket->isOverdue())
} ?> } ?>
<?php <?php
if($thisstaff->canEditTickets()) { ?> if($thisstaff->canEditTickets()) { ?>
<a class="action-button" href="#"
onclick="javascript:
$.userLookup('ajax.php/tickets/<?php echo $ticket->getId(); ?>/change-user',
function(user) {
var cid = <?php echo $ticket->getOwnerId(); ?>;
if(cid!=user.id && $('.dialog#confirm-action #changeuser-confirm').length) {
$('#newuser').html(user.name +' <'+user.email+'>');
$('.dialog#confirm-action #action').val('changeuser');
$('#confirm-form').append('<input type=hidden name=user_id value='+user.id+' />');
$('#overlay').show();
$('.dialog#confirm-action .confirm-action').hide();
$('.dialog#confirm-action p#changeuser-confirm')
.show()
.parent('div').show().trigger('click');
}
});
return false;
"><i class="icon-edit"></i> Change Owner</a>
<a class="action-button" href="tickets.php?id=<?php echo $ticket->getId(); ?>&a=edit"><i class="icon-edit"></i> Edit</a> <a class="action-button" href="tickets.php?id=<?php echo $ticket->getId(); ?>&a=edit"><i class="icon-edit"></i> Edit</a>
<?php <?php
} ?> } ?>
<?php <?php
if($ticket->isOpen() && !$ticket->isAssigned() && $thisstaff->canAssignTickets()) {?> if($ticket->isOpen() && !$ticket->isAssigned() && $thisstaff->canAssignTickets()) {?>
<a id="ticket-claim" class="action-button" href="#claim"><i class="icon-user"></i> Claim</a> <a id="ticket-claim" class="action-button" href="#claim"><i class="icon-user"></i> Claim</a>
...@@ -101,6 +82,10 @@ if($ticket->isOverdue()) ...@@ -101,6 +82,10 @@ if($ticket->isOverdue())
<div id="action-dropdown-more" class="action-dropdown anchor-right"> <div id="action-dropdown-more" class="action-dropdown anchor-right">
<ul> <ul>
<?php <?php
if($thisstaff->canEditTickets()) { ?>
<li><a class="change-user" href="#tickets/<?php echo $ticket->getId(); ?>/change-user"><i class="icon-user"></i> Change Ticket Owner</a></li>
<?php
}
if($ticket->isOpen() && ($dept && $dept->isManager($thisstaff))) { if($ticket->isOpen() && ($dept && $dept->isManager($thisstaff))) {
if($ticket->isAssigned()) { ?> if($ticket->isAssigned()) { ?>
...@@ -162,12 +147,15 @@ if($ticket->isOverdue()) ...@@ -162,12 +147,15 @@ if($ticket->isOverdue())
<table border="0" cellspacing="" cellpadding="4" width="100%"> <table border="0" cellspacing="" cellpadding="4" width="100%">
<tr> <tr>
<th width="100">Client:</th> <th width="100">Client:</th>
<td><a href="ajax.php/form/user-info/<?php <td><a href="#tickets/<?php echo $ticket->getId(); ?>/user"
echo $ticket->getOwnerId(); ?>"
onclick="javascript: onclick="javascript:
$('#overlay').show(); $.userLookup('ajax.php/tickets/<?php echo $ticket->getId(); ?>/user',
$('#user-info .body').load(this.href); function (user) {
$('#user-info').show(); $('#user-'+user.id+'-name').text(user.name);
$('#user-'+user.id+'-email').text(user.email);
$('#user-to-name').text(user.name);
$('#user-to-email').text(user.email);
});
return false; return false;
"><i class="icon-user"></i> <span id="user-<?php echo $ticket->getOwnerId(); ?>-name" "><i class="icon-user"></i> <span id="user-<?php echo $ticket->getOwnerId(); ?>-name"
><?php echo Format::htmlchars($ticket->getName()); ><?php echo Format::htmlchars($ticket->getName());
...@@ -198,7 +186,7 @@ if($ticket->isOverdue()) ...@@ -198,7 +186,7 @@ if($ticket->isOverdue())
<tr> <tr>
<th>Email:</th> <th>Email:</th>
<td> <td>
<?php echo $ticket->getEmail(); ?> <span id="user-<?php echo $ticket->getOwnerId(); ?>-email"><?php echo $ticket->getEmail(); ?></span>
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -423,10 +411,8 @@ $tcount+= $ticket->getNumNotes(); ...@@ -423,10 +411,8 @@ $tcount+= $ticket->getNumNotes();
</td> </td>
<td> <td>
<?php <?php
$to = $ticket->getReplyToEmail(); echo sprintf('<span id="user-to-name">%s</span> <em>&lt;<span id="user-to-email">%s</span>&gt;</em>',
if(($name=$ticket->getName()) && !strpos($name,'@')) $ticket->getName(), $ticket->getReplyToEmail());
$to =sprintf('%s <em>&lt;%s&gt;</em>', $name, $to);
echo $to;
?> ?>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<label><input type='checkbox' value='1' name="emailreply" id="remailreply" <label><input type='checkbox' value='1' name="emailreply" id="remailreply"
...@@ -926,3 +912,26 @@ $tcount+= $ticket->getNumNotes(); ...@@ -926,3 +912,26 @@ $tcount+= $ticket->getNumNotes();
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<script type="text/javascript" src="js/ticket.js"></script> <script type="text/javascript" src="js/ticket.js"></script>
<script type="text/javascript">
$(function() {
$(document).on('click', 'a.change-user', function(e) {
e.preventDefault();
var tid = <?php echo $ticket->getOwnerId(); ?>;
var cid = <?php echo $ticket->getOwnerId(); ?>;
var url = 'ajax.php/'+$(this).attr('href').substr(1);
$.userLookup(url, function(user) {
if(cid!=user.id
&& $('.dialog#confirm-action #changeuser-confirm').length) {
$('#newuser').html(user.name +' <'+user.email+'>');
$('.dialog#confirm-action #action').val('changeuser');
$('#confirm-form').append('<input type=hidden name=user_id value='+user.id+' />');
$('#overlay').show();
$('.dialog#confirm-action .confirm-action').hide();
$('.dialog#confirm-action p#changeuser-confirm')
.show()
.parent('div').show().trigger('click');
}
});
});
});
</script>
...@@ -1277,6 +1277,11 @@ time { ...@@ -1277,6 +1277,11 @@ time {
padding-right: 3em; padding-right: 3em;
} }
.dialog a {
color:#184E81;
}
.dialog a.close { .dialog a.close {
position: absolute; position: absolute;
display:inline-block; display:inline-block;
......
...@@ -404,7 +404,8 @@ $(document).ready(function(){ ...@@ -404,7 +404,8 @@ $(document).ready(function(){
$('.dialog#popup .body').load(url, function () { $('.dialog#popup .body').load(url, function () {
$('#overlay').show(); $('#overlay').show();
$('.dialog#popup').show(); $('.dialog#popup').show();
$(document).on('submit', '.dialog#popup form.user',function(e) { $(document).off('.user');
$(document).on('submit.user', '.dialog#popup form.user',function(e) {
e.preventDefault(); e.preventDefault();
var $form = $(this); var $form = $(this);
var $dialog = $form.closest('.dialog'); var $dialog = $form.closest('.dialog');
......
...@@ -345,7 +345,7 @@ jQuery(function($) { ...@@ -345,7 +345,7 @@ jQuery(function($) {
}); });
//ticket actions confirmation - Delete + more //ticket actions confirmation - Delete + more
$('a#ticket-delete, a#ticket-claim, #action-dropdown-more li a').click(function(e) { $('a#ticket-delete, a#ticket-claim, #action-dropdown-more li a:not(.change-user)').click(function(e) {
e.preventDefault(); e.preventDefault();
if($('.dialog#confirm-action '+$(this).attr('href')+'-confirm').length) { if($('.dialog#confirm-action '+$(this).attr('href')+'-confirm').length) {
var action = $(this).attr('href').substr(1, $(this).attr('href').length); var action = $(this).attr('href').substr(1, $(this).attr('href').length);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment