BUG 0000 Case Notes Improvements

This commit is contained in:
Erik Amaru Ortiz
2011-09-22 12:50:40 -04:00
parent c88e462b6f
commit 787c38e6e1
2 changed files with 263 additions and 209 deletions

View File

@@ -945,3 +945,49 @@ antes funcionaba.
.x-toolbar1 .x-btn-bl { background-position: 0 -3px; }
.x-toolbar1 .x-btn-br { background-position: -3px -3px; }
.x-toolbar1 .x-btn-bc { background-position: 0 -15px; }
/* Case Notes styles */
.x-cnotes-source {
border: 1px solid #EDEDED;
background-color: #fff;
cursor: pointer;
}
.x-cnotes-view td {
font-family: verdana,arial,sans-serif;
font-size: 12px;
}
td.x-cnotes-label {
/*background-color: #ddd;*/
border: 1px solid #EDEDED;
font-weight: bold;
text-align: right;
width: 40px;
padding: 0px 3px 0px 0px;
}
.x-cnotes-over {
background-color:#EBEBEB;
cursor: pointer;
}
.x-cnotes-selected {
background-color: #DFE8F6;
cursor: pointer;
}
.user-from {
font-size: 12px;
font-weight: bold;
}
.x-message {
/* top rig top left */
padding: 5px 5px 5px 10px;
font: 11px arial,tahoma,helvetica,sans-serif;
color: #465070;
}

View File

@@ -1,4 +1,6 @@
/* Case Notes - Start */
var newNoteAreaActive = false;
var caseNotesWindow;
function closeCaseNotesWindow(){
if(Ext.get("caseNotesWindowPanel")){
@@ -6,7 +8,8 @@ function closeCaseNotesWindow(){
}
}
function openCaseNotesWindow(appUid,modalSw){
function openCaseNotesWindow(appUid,modalSw)
{
if(!appUid) appUid="";
var startRecord=0;
@@ -16,13 +19,16 @@ function openCaseNotesWindow(appUid,modalSw){
url : '../appProxy/getNotesList?appUid='+appUid,
root: 'notes',
totalProperty: 'totalCount',
fields: ['USR_USERNAME','USR_FIRSTNAME','USR_LASTNAME','USR_FULL_NAME','NOTE_DATE','NOTE_CONTENT'],
fields: ['USR_USERNAME','USR_FIRSTNAME','USR_LASTNAME','USR_FULL_NAME','NOTE_DATE','NOTE_CONTENT', 'USR_UID', 'user'],
baseParams:{
start:startRecord,
limit:startRecord+loadSize
},
listeners:{
load:function(){
caseNotesWindow.setTitle(_('ID_CASES_NOTES') + ' (' + storeNotes.data.items.length + ')');
if(storeNotes.getCount()<storeNotes.getTotalCount()){
Ext.getCmp('CASES_MORE_BUTTON').show();
}else{
@@ -33,43 +39,6 @@ function openCaseNotesWindow(appUid,modalSw){
});
storeNotes.load();
// note added by krlos pacha carlos-at-colosa.com
// code added to get info about the users' name configuration
// to can see the correct user name set into enviroment
var userName = '';
switch(FORMATS.FullNameFormat){
case '@lastName, @firstName (@userName)':
userName = '{USR_LASTNAME}, {USR_FIRSTNAME} ({USR_USERNAME})';break;
case '@firstName @lastName':
userName = '{USR_FIRSTNAME} {USR_LASTNAME}';break;
case '@firstName @lastName (@userName)':
userName = '{USR_FIRSTNAME} {USR_LASTNAME} ({USR_USERNAME})';break;
case '@userName':
userName = '{USR_USERNAME}';break;
case '@userName (@firstName @lastName)':
userName = '{USR_USERNAME} ({USR_FIRSTNAME} {USR_LASTNAME})';break;
case '@lastName @firstName':
userName = '{USR_LASTNAME} {USR_FIRSTNAME}';break;
case '@lastName, @firstName':
userName = '{USR_LASTNAME}, {USR_FIRSTNAME}';break;
case '@lastName, @firstName (@userName)':
userName = '{USR_LASTNAME}, {USR_FIRSTNAME} ({USR_USERNAME})';break;
}
var tplNotes = new Ext.XTemplate(
'<tpl for=".">',
'<div class="thumb-wrap">',
'<div class="thumb" >',
'<span class="x-editable"><b>'+userName+'</b></span><br>',
'<span class="x-editable">{NOTE_CONTENT}</span><br>',
'<span class="x-editable"><small><i>{NOTE_DATE}</i></small><hr /></span>',
'</div>',
'</div>',
'</tpl>',
'<div class="x-clear"></div>'
);
var panelNotes = new Ext.Panel({
id:'notesPanel',
@@ -77,23 +46,37 @@ function openCaseNotesWindow(appUid,modalSw){
autoWidth:true,
autoHeight:true,
collapsible:false,
items:[ new Ext.DataView({
items:[
new Ext.DataView({
store: storeNotes,
tpl: tplNotes,
autoWidth:true,
loadingtext:_('ID_CASE_NOTES_LOADING'),
autoScroll:true,
multiSelect: false,
overClass:'x-view-over',
itemSelector:'div.thumb-wrap',
// autoScroll:true,
emptyText: _('ID_CASE_NOTES_EMPTY'),
cls: 'x-cnotes-view',
tpl: '<tpl for=".">' +
'<div class="x-cnotes-source"><table><tbody>' +
'<tr>' +
'<td class="x-cnotes-label"><img border="0" src="../users/users_ViewPhotoGrid?pUID={USR_UID}" width="40" height="40"/></td>' +
'<td class="x-cnotes-name">'+
'<p class="user-from">{user}</p>'+
'<p class="x-editable x-message">{NOTE_CONTENT}</p> '+
'<p class="x-editable"><small>'+_('ID_POSTED_AT')+'<i> {NOTE_DATE}</i></small></p>'+
'</td>' +
'</tr>' +
'</tbody></table></div>' +
'</tpl>',
itemSelector: 'div.x-cnotes-source',
overClass: 'x-cnotes-over',
selectedClass: 'x-cnotes-selected',
singleSelect: true,
prepareData: function(data){
//data.shortName = Ext.util.Format.ellipsis(data.name, 15);
//data.sizeString = Ext.util.Format.fileSize(data.size);
//data.dateString = data.lastmod.format("m/d/Y g:i a");
//console.log(data);
data.user = _FNF(data.USR_USERNAME, data.USR_FIRSTNAME, data.USR_LASTNAME);
data.NOTE_CONTENT = data.NOTE_CONTENT.replace(/\n/g,' <br/>');
return data;
},
@@ -107,9 +90,6 @@ function openCaseNotesWindow(appUid,modalSw){
},
click: {
fn: function(dv,nodes,a){
//console.info("Click");
//console.log(dv);
//console.log(a);
}
}
}
@@ -130,11 +110,76 @@ function openCaseNotesWindow(appUid,modalSw){
}
});
}
}]
}
]
});
var caseNotesWindow;
caseNotesWindow = new Ext.Window({
var tbar = [
{
//xtype:'textfield',
xtype : 'textarea',
id : 'caseNoteText',
name : 'caseNoteText',
hideLabel : true,
blankText : '...',
//anchor: '100%',
width : 248,
grow : true,
maxLenght : 150,
allowBlank:true,
selectOnFocus:true,
height : 40,
growMin: 39,
growMax: 80
},
' ',
{
cls: 'x-toolbar1',
text: _('ID_SEND'),
//iconCls: 'x-pm-notes-btn',
scale: 'large',
stype:'button',
iconAlign: 'top',
handler: function(){
var noteText = Ext.getCmp('caseNoteText').getValue();
if (noteText == "") {
return false;
}
newNoteHandler();
Ext.getCmp('caseNoteText').focus();
Ext.getCmp('caseNoteText').reset();
statusBarMessage( _('ID_CASES_NOTE_POSTING'), true);
Ext.Ajax.request({
url : '../appProxy/postNote' ,
params : {
appUid:appUid,
noteText:noteText
},
success: function ( result, request ) {
var data = Ext.util.JSON.decode(result.responseText);
if(data.success=="success"){
statusBarMessage( _('ID_CASES_NOTE_POST_SUCCESS'), false,true);
storeNotes.load();
}else{
statusBarMessage( _('ID_CASES_NOTE_POST_ERROR'), false,false);
Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_ERROR'), data.message);
}
},
failure: function ( result, request) {
statusBarMessage( _('ID_CASES_NOTE_POST_FAILED'), false,false);
Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_FAILED'), result.responseText);
}
});
}
}
];
caseNotesWindow = new Ext.Window({
title: _('ID_CASES_NOTES'), //Title of the Window
id: 'caseNotesWindowPanel', //ID of the Window Panel
width:300, //Width of the Window
@@ -164,20 +209,22 @@ caseNotesWindow = new Ext.Window({
}
}
],
tbar:tbar,
bbar:[
new Ext.ux.StatusBar({
defaultText : _('ID_NOTES_READY'),
id : 'notesStatusPanel',
//defaultIconCls: 'ICON_CASES_NOTES',
// values to set initially:
text: _('ID_NOTES_READY'),
text: _('ID_NOTES_READY'), // values to set initially:
//iconCls: 'ready-icon',
statusAlign: 'left',
// any standard Toolbar items:
items: []
}),
{xtype: 'tbfill'},
items: [] // any standard Toolbar items:
}), '->',
{
id: 'newNoteButton',
text: _('ID_NEW_NOTE'),
handler: newNoteHandler
},
{
text: _('ID_CANCEL'),
handler: function()
@@ -186,78 +233,39 @@ caseNotesWindow = new Ext.Window({
}
}
],
tbar:[{
//xtype:'textfield',
xtype:'textarea',
id:'caseNoteText',
name:'caseNoteText',
hideLabel: true,
blankText:_('ID_CASES_NOTES_POST'),
anchor: '100% -53',
width:200,
grow:true,
selectOnFocus:true,
maxLenght:150,
allowBlank:true
},
' ',
{
cls: 'x-toolbar1',
text: _('ID_SUBMIT_NOTE'),
iconCls: 'x-pm-notes-btn',
scale: 'large',
stype:'button',
iconAlign: 'top',
handler: function(){
var noteText = Ext.getCmp('caseNoteText').getValue();
if (noteText == "") {
return false;
}
Ext.getCmp('caseNoteText').focus();
Ext.getCmp('caseNoteText').reset();
statusBarMessage( _('ID_CASES_NOTE_POSTING'), true);
Ext.Ajax.request({
url : '../appProxy/postNote' ,
params : {
appUid:appUid,
noteText:noteText
},
success: function ( result, request ) {
var data = Ext.util.JSON.decode(result.responseText);
if(data.success=="success"){
statusBarMessage( _('ID_CASES_NOTE_POST_SUCCESS'), false,true);
storeNotes.load();
}else{
statusBarMessage( _('ID_CASES_NOTE_POST_ERROR'), false,false);
Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_ERROR'), data.message);
}
},
failure: function ( result, request) {
statusBarMessage( _('ID_CASES_NOTE_POST_FAILED'), false,false);
Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_FAILED'), result.responseText);
}
});
}
}],
listeners:{
listeners: {
show:function() {
this.loadMask = new Ext.LoadMask(this.body, {
msg:_('ID_LOADING')
});
},
close:function(){
//console.log(Ext.get("caseNotes"));
if(Ext.get("caseNotes")){
if (Ext.get("caseNotes")) {
Ext.getCmp("caseNotes").toggle(false);
//Ext.getCmp('caseNotes').show();
}
}
}
});
caseNotesWindow.show();
});
caseNotesWindow.getTopToolbar().hide();
caseNotesWindow.show();
}
function newNoteHandler()
{
newNoteAreaActive = newNoteAreaActive ? false : true;
if (newNoteAreaActive) {
Ext.getCmp('newNoteButton').setText(_('ID_CANCEL_NEW_NOTE'));
caseNotesWindow.getTopToolbar().show();
Ext.getCmp('caseNoteText').focus();
Ext.getCmp('caseNoteText').reset();
}
else {
Ext.getCmp('newNoteButton').setText(_('ID_NEW_NOTE'));
caseNotesWindow.getTopToolbar().hide();
}
caseNotesWindow.doLayout();
}
function statusBarMessage( msg, isLoading, success ) {