Changed user view to load enquiry table by default
This commit is contained in:
parent
01dfc91cee
commit
b233ead647
|
|
@ -82,6 +82,26 @@ class EmailsController extends AppController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch all the Emails that are from, to, cc a User ID
|
||||
*
|
||||
* @param <type> $id
|
||||
* @return <type>
|
||||
*/
|
||||
function view_user_emails($id) {
|
||||
if(!$id) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$fromEmails = $this->Email->find('list', array('fields'=>array('Email.id'), 'recursive'=>0, 'conditions'=>array('Email.user_id'=>$id)));
|
||||
$recEmails = $this->Email->EmailRecipient->find('all', array('fields'=>array('Email.id'),'recursive'=>0, 'conditions'=>array('EmailRecipient.user_id'=>$id)));
|
||||
|
||||
$this->set('emails', $fromEmails);
|
||||
$this->set('recEmails', $recEmails);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* old shit here, Might be useful */
|
||||
|
|
@ -100,14 +120,7 @@ class EmailsController extends AppController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* View Emails to, from or CC a particular user ID.
|
||||
*
|
||||
*
|
||||
*/
|
||||
function view_user_emails($id) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
$(function() {
|
||||
|
||||
$('#hide').hide();
|
||||
$('#show').hide();
|
||||
$('#enquiryTable').hide();
|
||||
|
||||
$("#ajaxLoad").hide();
|
||||
|
|
@ -14,19 +14,8 @@ $(function() {
|
|||
|
||||
var userID = $('#userID').text();
|
||||
|
||||
var alreadyFetched = false;
|
||||
|
||||
$('#show').click(function() {
|
||||
$(this).hide();
|
||||
$('#hide').show();
|
||||
|
||||
if(alreadyFetched == false) {
|
||||
|
||||
alreadyFetched = true;
|
||||
}
|
||||
$.get('/enquiries/view_user_enquiries/'+userID, function(data) {
|
||||
$('#enquiryTable').html(data);
|
||||
});
|
||||
$.get('/enquiries/view_user_enquiries/'+userID, function(data) {
|
||||
$('#enquiryTable').html(data);
|
||||
$('#enquiryTable').slideDown('fast');
|
||||
|
||||
});
|
||||
|
|
@ -37,6 +26,14 @@ $(function() {
|
|||
$('#show').show();
|
||||
|
||||
$('#enquiryTable').slideUp('fast');
|
||||
});
|
||||
|
||||
|
||||
$('#show').click(function() {
|
||||
$(this).hide();
|
||||
$('#hide').show();
|
||||
|
||||
$('#enquiryTable').slideDown('fast');
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue