diff --git a/erpnext/home/page/desktop/desktop.js b/erpnext/home/page/desktop/desktop.js index 93acd08dd3..7bc2aba9cd 100644 --- a/erpnext/home/page/desktop/desktop.js +++ b/erpnext/home/page/desktop/desktop.js @@ -126,7 +126,7 @@ erpnext.desktop.show_pending_notifications = function() { add_circle('todo', 'things_todo', 'Things To Do'); add_circle('calendar', 'todays_events', 'Todays Events'); - update_messages(); + erpnext.update_messages(); } diff --git a/erpnext/stock/doctype/purchase_receipt/listview.js b/erpnext/stock/doctype/purchase_receipt/listview.js new file mode 100644 index 0000000000..4275b54884 --- /dev/null +++ b/erpnext/stock/doctype/purchase_receipt/listview.js @@ -0,0 +1,18 @@ +// render +wn.doclistviews['Purchase Receipt'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d); + this.fields = this.fields.concat([ + "`tabPurchase Receipt`.supplier_name", + "`tabPurchase Receipt`.purchase_order_no" + ]); + }, + columns: [ + {width: '5%', content:'avatar'}, + {width: '3%', content:'docstatus'}, + {width: '15%', content:'name'}, + {width: '50%', content:'tags+supplier_name', css: {color:'#aaa'}}, + {width: '15%', content:'purchase_order_no', type:'link', doctype:'Purchase Order Order'}, + {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} + ] +}); diff --git a/erpnext/stock/doctype/stock_entry/listview.js b/erpnext/stock/doctype/stock_entry/listview.js new file mode 100644 index 0000000000..4c52e9e7bb --- /dev/null +++ b/erpnext/stock/doctype/stock_entry/listview.js @@ -0,0 +1,20 @@ +// render +wn.doclistviews['Stock Entry'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d); + this.fields = this.fields.concat([ + "`tabStock Entry`.purpose", + "`tabStock Entry`.from_warehouse", + "`tabStock Entry`.to_warehouse", + ]); + }, + columns: [ + {width: '5%', content:'avatar'}, + {width: '3%', content:'docstatus'}, + {width: '15%', content:'name'}, + {width: '18%', content:'tags+purpose', css: {color:'#aaa'}}, + {width: '18%', content:'from_warehouse', template: 'From %(from_warehouse)s'}, + {width: '18%', content:'to_warehouse', template: 'To %(to_warehouse)s'}, + {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} + ] +}); diff --git a/erpnext/utilities/page/messages/messages.js b/erpnext/utilities/page/messages/messages.js index ef56020291..9283f9430f 100644 --- a/erpnext/utilities/page/messages/messages.js +++ b/erpnext/utilities/page/messages/messages.js @@ -19,7 +19,7 @@ wn.provide('erpnext.messages'); wn.pages.messages.onload = function(wrapper) { erpnext.messages.show_active_users(); erpnext.messages.make_list(); - update_messages('reset'); //Resets notification icons + erpnext.update_messages('reset'); //Resets notification icons // post message $('#message-post').click(function() { diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js index a600934a88..b093faab5d 100644 --- a/erpnext/website/js/topbar.js +++ b/erpnext/website/js/topbar.js @@ -40,7 +40,7 @@ erpnext.navbar.Navbar = Class.extend({ \ \
\ \ \ diff --git a/js/all-app.js b/js/all-app.js index c35273ee9b..05b7938c55 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -839,7 +839,7 @@ if(this.txt){try{this.txt.focus();}catch(e){} this.txt.field_object=this;}} function DataField(){}DataField.prototype=new Field();DataField.prototype.make_input=function(){var me=this;this.input=$a_input(this.input_area,this.df.fieldtype=='Password'?'password':'text');this.get_value=function(){var v=this.input.value;if(this.validate) v=this.validate(v);return v;} -this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value($(this).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val;} +this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value&&me.get_value()||$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val;} me.set(val);if(me.format_input) me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt(me.last_value)==flt(val)){me.last_value=val;return;}} me.last_value=val;me.run_trigger();} @@ -884,7 +884,7 @@ _f.calling_doc_stack.push([me.doctype,me.docname]);new_doc(me.df.options,me.on_n LinkField.prototype.set_input_value=function(val){var me=this;var from_selector=false;if(selector&&selector.display)from_selector=true;me.refresh_label_icon();if(me.not_in_form){$(this.txt).val(val);return;} if(cur_frm){if(val==locals[me.doctype][me.docname][me.df.fieldname]){me.run_trigger();return;}} me.set(val);if(_f.cur_grid_cell) -_f.cur_grid_cell.grid.cell_deselect();if(!val){me.run_trigger();return;} +_f.cur_grid_cell.grid.cell_deselect();if(locals[me.doctype][me.docname][me.df.fieldname]&&!val){me.run_trigger();return;} var fetch='';if(cur_frm.fetch_dict[me.df.fieldname]) fetch=cur_frm.fetch_dict[me.df.fieldname].columns.join(', ');$c('webnotes.widgets.form.utils.validate_link',{'value':val,'options':me.df.options,'fetch':fetch},function(r,rt){if(r.message=='Ok'){if($(me.txt).val()!=val){if((me.grid&&!from_selector)||(!me.grid)){$(me.txt).val(val);}} if(r.fetch_values) @@ -1042,6 +1042,13 @@ me.btn.set_working=me.set_working;me.btn.done_working=me.done_working;if(me.btn. wn.dom.css(me.btn,args.style);},set_working:function(){me.btn.disabled='disabled';if(me.btn.args.is_ajax){$(me.btn).css('margin-right','0px');} $(me.loading_img).css('display','inline');},done_working:function(){me.btn.disabled=false;if(me.btn.args.is_ajax){$(me.btn).css('margin-right','24px');} $(me.loading_img).toggle(false);}});this.make();} +/* + * lib/js/wn/ui/search.js + */ +wn.ui.Search=Class.extend({init:function(opts){$.extend(this,opts);var me=this;wn.model.with_doctype(this.doctype,function(r){me.make();me.dialog.show();});},make:function(){var me=this;this.dialog=new wn.ui.Dialog({title:this.doctype+' Search',width:500});this.list=new wn.ui.Listing({parent:$(this.dialog.body),appframe:this.dialog.appframe,new_doctype:this.doctype,doctype:this.doctype,method:'webnotes.widgets.doclistview.get',show_filters:true,style:'compact',get_args:function(){if(me.query){me.page_length=50;return{query:me.query}}else{return{doctype:me.doctype,fields:['`tab'+me.doctype+'`.name'],filters:me.list.filter_list.get_filters(),docstatus:['0','1']}}},render_row:function(parent,data){$ln=$('' ++data.name+'').appendTo(parent).click(function(){var val=$(this).attr('data-name');me.dialog.hide();if(me.callback) +me.callback(val);else +wn.set_route('Form',me.doctype,val);});}});this.list.filter_list.add_filter('name','like');this.list.run();}}) /* * lib/js/legacy/widgets/dialog.js */ @@ -1387,7 +1394,7 @@ wn.ui.toolbar.NewDialog=wn.ui.toolbar.SelectorDialog.extend({init:function(){thi /* * lib/js/wn/ui/toolbar/search.js */ -wn.ui.toolbar.Search=wn.ui.toolbar.SelectorDialog.extend({init:function(){this._super({title:"Search",execute:function(val){selector.set_search(val);selector.show();},});this.set_values(wn.boot.profile.can_search.join(',').split(','));makeselector();}}); +wn.ui.toolbar.Search=wn.ui.toolbar.SelectorDialog.extend({init:function(){this._super({title:"Search",execute:function(val){new wn.ui.Search({doctype:val});},});this.set_values(wn.boot.profile.can_search.join(',').split(','));makeselector();}}); /* * lib/js/wn/ui/toolbar/report.js */ @@ -1523,7 +1530,7 @@ if(this.txt){try{this.txt.focus();}catch(e){} this.txt.field_object=this;}} function DataField(){}DataField.prototype=new Field();DataField.prototype.make_input=function(){var me=this;this.input=$a_input(this.input_area,this.df.fieldtype=='Password'?'password':'text');this.get_value=function(){var v=this.input.value;if(this.validate) v=this.validate(v);return v;} -this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value($(this).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val;} +this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value&&me.get_value()||$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val;} me.set(val);if(me.format_input) me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt(me.last_value)==flt(val)){me.last_value=val;return;}} me.last_value=val;me.run_trigger();} @@ -1568,7 +1575,7 @@ _f.calling_doc_stack.push([me.doctype,me.docname]);new_doc(me.df.options,me.on_n LinkField.prototype.set_input_value=function(val){var me=this;var from_selector=false;if(selector&&selector.display)from_selector=true;me.refresh_label_icon();if(me.not_in_form){$(this.txt).val(val);return;} if(cur_frm){if(val==locals[me.doctype][me.docname][me.df.fieldname]){me.run_trigger();return;}} me.set(val);if(_f.cur_grid_cell) -_f.cur_grid_cell.grid.cell_deselect();if(!val){me.run_trigger();return;} +_f.cur_grid_cell.grid.cell_deselect();if(locals[me.doctype][me.docname][me.df.fieldname]&&!val){me.run_trigger();return;} var fetch='';if(cur_frm.fetch_dict[me.df.fieldname]) fetch=cur_frm.fetch_dict[me.df.fieldname].columns.join(', ');$c('webnotes.widgets.form.utils.validate_link',{'value':val,'options':me.df.options,'fetch':fetch},function(r,rt){if(r.message=='Ok'){if($(me.txt).val()!=val){if((me.grid&&!from_selector)||(!me.grid)){$(me.txt).val(val);}} if(r.fetch_values) @@ -1939,8 +1946,7 @@ return{}} _f.grid_date_cell='';_f.grid_refresh_date=function(){_f.grid_date_cell.grid.set_cell_value(_f.grid_date_cell);} _f.grid_refresh_field=function(temp,input){if($(input).val()!=_f.get_value(temp.doctype,temp.docname,temp.df.fieldname)) $(input).trigger('change');} -_f.Grid.prototype.remove_template=function(cell){var hc=this.head_row.cells[cell.cellIndex];if(!hc.template)return;if(!hc.template.activated)return;if(hc.template.df.fieldtype=='Date'){_f.grid_date_cell=cell;setTimeout('_f.grid_refresh_date()',100);}else{var input=hc.template.txt||hc.template.input;_f.grid_refresh_field(hc.template,input)} -if(hc.template&&hc.template.wrapper.parentNode) +_f.Grid.prototype.remove_template=function(cell){var hc=this.head_row.cells[cell.cellIndex];if(!hc.template)return;if(!hc.template.activated)return;if(hc.template&&hc.template.wrapper.parentNode) cell.div.removeChild(hc.template.wrapper);this.set_cell_value(cell);hc.template.activated=0;} _f.Grid.prototype.notify_keypress=function(e,keycode){if(keycode>=37&&keycode<=40&&e.shiftKey){if(text_dialog&&text_dialog.display){return;}}else return;if(!_f.cur_grid_cell)return;if(_f.cur_grid_cell.grid!=this)return;var ri=_f.cur_grid_cell.row.rowIndex;var ci=_f.cur_grid_cell.cellIndex;switch(keycode){case 38:if(ri>0){this.cell_select('',ri-1,ci);}break;case 40:if(ri<(this.tab.rows.length-1)){this.cell_select('',ri+1,ci);}break;case 39:if(ci<(this.head_row.cells.length-1)){this.cell_select('',ri,ci+1);}break;case 37:if(ci>1){this.cell_select('',ri,ci-1);}break;}} diff --git a/js/all-web.js b/js/all-web.js index cb193e3edc..2430e89507 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -879,7 +879,7 @@ wn.provide('erpnext.navbar');erpnext.navbar.Navbar=Class.extend({init:function() \ \ \ \ \