From 09a897afe47f8633085af9a25518c297c2857ff9 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 20 Feb 2012 18:30:52 +0530 Subject: [PATCH] added selling-home --- css/all-app.css | 31 ++-- css/all-web.css | 10 +- .../home/page/event_updates/event_updates.js | 4 +- erpnext/selling/doctype/campaign/campaign.txt | 160 +++++------------- erpnext/selling/page/selling_home/__init__.py | 12 ++ .../page/selling_home/selling_home.html | 65 +++++++ .../selling/page/selling_home/selling_home.js | 40 +++++ .../page/selling_home/selling_home.txt | 43 +++++ js/all-app.js | 19 ++- js/all-web.js | 11 +- version.num | 2 +- 11 files changed, 239 insertions(+), 158 deletions(-) create mode 100644 erpnext/selling/page/selling_home/__init__.py create mode 100644 erpnext/selling/page/selling_home/selling_home.html create mode 100644 erpnext/selling/page/selling_home/selling_home.js create mode 100644 erpnext/selling/page/selling_home/selling_home.txt diff --git a/css/all-app.css b/css/all-app.css index 18a99f5aa4c..b38d5cb6905 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -234,10 +234,15 @@ div.std-footer-item { padding: 15px; } +.layout-wrapper-background { + background-color: #f2f2f2 !important; + padding: 0px; +} + .layout-main-section { width: 68%; float: left; - padding: 13px; + padding: 15px; background-color: #FFF; min-height: 450px; } @@ -245,10 +250,9 @@ div.std-footer-item { .layout-side-section { width: 24%; float: right; - margin-right: 15px; color: #606060; overflow-x: hidden; - padding: 13px; + padding: 15px; min-height: 450px; } @@ -1619,46 +1623,39 @@ ul.box_tabs li.box_tab_selected a { /* * lib/css/legacy/sidebar.css - */div.psidebar-wrapper { - margin: 0px 8px; + */div.psidebar { } -div.psidebar-head { +div.psidebar div.head { font-size: 14px; font-weight: bold; color: #555; margin-bottom: 12px; } -div.psidebar-section { +div.psidebar div.section { margin-bottom: 11px; overflow: hidden; } -div.psidebar-section-head { +div.psidebar div.section-head { font-size: 12px; padding: 5px 11px; border-bottom: 2px solid #444; } -div.psidebar-section-body { +div.psidebar div.section-body { margin: 7px 11px 11px 11px; } -div.psidebar-section-item { +div.psidebar div.section-item { margin-bottom: 7px; } -.psidebar-section-link { +div.psidebar .section-link { font-size: 11px; color: #666; } - -div.follower-list { - color: #666; - margin-top: 7px; - font-size: 11px; -} /* * lib/css/bootstrap/bootstrap-buttons.css */.btn.danger, diff --git a/css/all-web.css b/css/all-web.css index 43e94e487d8..96574e329e0 100644 --- a/css/all-web.css +++ b/css/all-web.css @@ -234,10 +234,15 @@ div.std-footer-item { padding: 15px; } +.layout-wrapper-background { + background-color: #f2f2f2 !important; + padding: 0px; +} + .layout-main-section { width: 68%; float: left; - padding: 13px; + padding: 15px; background-color: #FFF; min-height: 450px; } @@ -245,10 +250,9 @@ div.std-footer-item { .layout-side-section { width: 24%; float: right; - margin-right: 15px; color: #606060; overflow-x: hidden; - padding: 13px; + padding: 15px; min-height: 450px; } diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js index 25c74ae9154..11dfdf8e336 100644 --- a/erpnext/home/page/event_updates/event_updates.js +++ b/erpnext/home/page/event_updates/event_updates.js @@ -16,9 +16,7 @@ pscript.home_make_body = function() { var wrapper = page_body.pages['Event Updates']; // body - $(wrapper).addClass('layout-wrapper') - .css('background-color', wn.sidebar_background).css('padding', '0px'); - wrapper.style.backgroud + $(wrapper).addClass('layout-wrapper').addClass('layout-wrapper-background') wrapper.body = $a(wrapper, 'div', 'layout-main-section'); wrapper.head = $a(wrapper.body, 'div'); diff --git a/erpnext/selling/doctype/campaign/campaign.txt b/erpnext/selling/doctype/campaign/campaign.txt index 1f1c3a02369..8810cb88557 100644 --- a/erpnext/selling/doctype/campaign/campaign.txt +++ b/erpnext/selling/doctype/campaign/campaign.txt @@ -5,164 +5,84 @@ { 'creation': '2010-08-08 17:08:54', 'docstatus': 0, - 'modified': '2010-09-20 14:06:57', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-02-20 18:06:32', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { + '_last_update': u'1326102553', 'allow_trash': 1, - 'autoname': 'field:campaign_name', - 'colour': 'White:FFF', + 'autoname': u'field:campaign_name', + 'colour': u'White:FFF', + 'default_print_format': u'Standard', 'doctype': 'DocType', - 'document_type': 'Master', - 'module': 'Selling', + 'document_type': u'Master', + 'module': u'Selling', 'name': '__common__', - 'section_style': 'Simple', - 'server_code_error': ' ', + 'section_style': u'Simple', + 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 6 + 'version': 7 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Campaign', - 'parentfield': 'fields', - 'parenttype': 'DocType' - }, - - # These values are common for all DocPerm - { - 'amend': 0, - 'doctype': 'DocPerm', - 'name': '__common__', - 'parent': 'Campaign', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'read': 1, - 'submit': 0 + 'parent': u'Campaign', + 'parentfield': u'fields', + 'parenttype': u'DocType' }, # DocType, Campaign { 'doctype': 'DocType', - 'name': 'Campaign' - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'idx': 1, - 'permlevel': 1, - 'role': 'Sales Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'idx': 2, - 'permlevel': 0, - 'role': 'Sales Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'idx': 3, - 'permlevel': 1, - 'role': 'Sales Master Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'idx': 4, - 'permlevel': 1, - 'role': 'Sales User', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'idx': 5, - 'permlevel': 0, - 'role': 'Sales User', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': 'DocPerm', - 'idx': 6, - 'permlevel': 0, - 'role': 'Sales Master Manager', - 'write': 1 + 'name': u'Campaign' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'trash_reason', - 'fieldtype': 'Small Text', - 'idx': 1, - 'label': 'Trash Reason', - 'oldfieldname': 'trash_reason', - 'oldfieldtype': 'Small Text', + 'doctype': u'DocField', + 'fieldname': u'trash_reason', + 'fieldtype': u'Small Text', + 'label': u'Trash Reason', + 'oldfieldname': u'trash_reason', + 'oldfieldtype': u'Small Text', 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'idx': 2, - 'label': 'Campaign', - 'oldfieldtype': 'Section Break', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Campaign', + 'oldfieldtype': u'Section Break', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'campaign_name', - 'fieldtype': 'Data', - 'idx': 3, - 'label': 'Campaign Name', - 'oldfieldname': 'campaign_name', - 'oldfieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'campaign_name', + 'fieldtype': u'Data', + 'label': u'Campaign Name', + 'oldfieldname': u'campaign_name', + 'oldfieldtype': u'Data', 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'description', - 'fieldtype': 'Text', - 'idx': 4, - 'label': 'Description', - 'oldfieldname': 'description', - 'oldfieldtype': 'Text', + 'doctype': u'DocField', + 'fieldname': u'description', + 'fieldtype': u'Text', + 'label': u'Description', + 'oldfieldname': u'description', + 'oldfieldtype': u'Text', 'permlevel': 0, - 'width': '300px' + 'width': u'300px' } ] \ No newline at end of file diff --git a/erpnext/selling/page/selling_home/__init__.py b/erpnext/selling/page/selling_home/__init__.py new file mode 100644 index 00000000000..959135f4728 --- /dev/null +++ b/erpnext/selling/page/selling_home/__init__.py @@ -0,0 +1,12 @@ +import webnotes + +@webnotes.whitelist() +def get_report_list(arg=None): + """return list of reports for this module""" + webnotes.response['values'] = webnotes.conn.sql("""select + distinct criteria_name, doc_type, parent_doc_type + from `tabSearch Criteria` + where module='Selling' + and docstatus in (0, NULL) + order by criteria_name + limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True) \ No newline at end of file diff --git a/erpnext/selling/page/selling_home/selling_home.html b/erpnext/selling/page/selling_home/selling_home.html new file mode 100644 index 00000000000..5c7f1b1100a --- /dev/null +++ b/erpnext/selling/page/selling_home/selling_home.html @@ -0,0 +1,65 @@ +
+
+

Selling

+
+
+

Lead

+

Prospective customers

+

Enquiry

+

Business opportunities

+

Quotation

+

Quotes sent to Leads / Customers

+

Sales Order

+

Confirmed orders from Customers

+
+
+

Customer

+

Customer Master

+

Item

+

Item Master

+
+
+
+

Reports

+
+
+
+
+
+
Setup
+
+ +
+ Sales BOM +
+ +
+ Territory +
+ + +
+ Campaign +
+
+
+
+
Tools
+
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/erpnext/selling/page/selling_home/selling_home.js b/erpnext/selling/page/selling_home/selling_home.js new file mode 100644 index 00000000000..76fac705eab --- /dev/null +++ b/erpnext/selling/page/selling_home/selling_home.js @@ -0,0 +1,40 @@ +pscript['onload_selling-home'] = function(wrapper) { + erpnext.module_page.hide_links(wrapper); + erpnext.module_page.make_list('Selling', wrapper); +} + +wn.provide('erpnext.module_page'); + +// hide list links where the user does +// not have read permissions + +erpnext.module_page.hide_links = function(wrapper) { + $(wrapper).find('[href*="List/"]').each(function() { + var href = $(this).attr('href'); + var dt = href.split('/')[1]; + if(wn.boot.profile.can_read.indexOf(dt)==-1) { + $(this).toggle(false); + } + }); +} + +// make list of reports + +erpnext.module_page.make_list = function(module, wrapper) { + // make project listing + wrapper.list = new wn.widgets.Listing({ + parent: $(wrapper).find('.reports-list').get(0), + method: 'selling.page.selling_home.get_report_list', + render_row: function(row, data) { + if(!data.parent_doc_type) data.parent_doc_type = data.doc_type; + $(row).html(repl('\ + %(criteria_name)s', data)) + }, + args: { + module: module + }, + no_refresh: true + }); + wrapper.list.run(); +} \ No newline at end of file diff --git a/erpnext/selling/page/selling_home/selling_home.txt b/erpnext/selling/page/selling_home/selling_home.txt new file mode 100644 index 00000000000..e6636a86484 --- /dev/null +++ b/erpnext/selling/page/selling_home/selling_home.txt @@ -0,0 +1,43 @@ +# Page, selling-home +[ + + # These values are common in all dictionaries + { + 'creation': '2012-02-20 15:46:39', + 'docstatus': 0, + 'modified': '2012-02-20 15:46:57', + 'modified_by': u'Administrator', + 'owner': u'Administrator' + }, + + # These values are common for all Page + { + 'doctype': 'Page', + 'module': u'Selling', + 'name': '__common__', + 'page_name': u'selling-home', + 'standard': u'Yes', + 'title': u'Selling Home' + }, + + # These values are common for all Page Role + { + 'doctype': u'Page Role', + 'name': '__common__', + 'parent': u'selling-home', + 'parentfield': u'roles', + 'parenttype': u'Page', + 'role': u'All' + }, + + # Page, selling-home + { + 'doctype': 'Page', + 'name': u'selling-home' + }, + + # Page Role + { + 'doctype': u'Page Role' + } +] \ No newline at end of file diff --git a/js/all-app.js b/js/all-app.js index e90debf2e9f..ecfc3bbfe3d 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -861,7 +861,7 @@ Listing.prototype.std_cell=function(cell,ri,ci,d){var has_headrow=this.colnames? */ wn.widgets.Listing=function(opts){this.opts=opts;this.page_length=20;this.btns={};this.start=0;var me=this;this.make=function(opts){this.wrapper=$a(this.opts.parent,'div');this.filters_area=$a(this.wrapper,'div','listing-filters');this.toolbar_area=$a(this.wrapper,'div','listing-toolbar');this.results_area=$a(this.wrapper,'div','listing-results');this.more_button_area=$a(this.wrapper,'div','listing-more');this.no_results_area=$a(this.wrapper,'div','help_box',{display:'none'},(this.opts.no_result_message?this.opts.no_result_message:'No results'));if(opts)this.opts=opts;this.page_length=this.opts.page_length?this.opts.page_length:this.page_length;this.make_toolbar();this.make_filters();this.make_more_button();} this.make_filters=function(){if(this.opts.filters){$ds(this.filters_area);this.filters=new wn.widgets.FieldGroup(this.filters_area,this.opts.fields);}} -this.make_toolbar=function(){if(!this.opts.hide_refresh){this.ref_img=$a(this.toolbar_area,'span','link_type',{color:'#888'},'[refresh]');this.ref_img.onclick=function(){me.run();} +this.make_toolbar=function(){if(!(this.opts.hide_refresh||this.opts.no_refresh)){this.ref_img=$a(this.toolbar_area,'span','link_type',{color:'#888'},'[refresh]');this.ref_img.onclick=function(){me.run();} this.loading_img=$a(this.toolbar_area,'img','lib/images/ui/button-load.gif',{display:'none',marginLeft:'3px',marginBottom:'-2px'});} if(this.opts.new_doctype){this.new_btn=$btn(this.toolbar_area,'New '+get_doctype_label(this.opts.new_doctype),function(){newdoc(me.opts.new_doctype,me.opts.new_doc_onload,me.opts.new_doc_indialog,me.opts.new_doc_onsave);},{marginLeft:'7px'});}} this.make_more_button=function(){this.more_btn=$btn(this.more_button_area,'More...',function(){me.more_btn.set_working();me.run(function(){me.more_btn.done_working();},1);},'',0,1);$y(this.more_btn.loading_img,{marginBottom:'0px'});} @@ -873,8 +873,9 @@ if(this.onrun)this.onrun();if(this.opts.onrun)this.opts.onrun();} this.add_row=function(){return $a(this.results_area,'div','',(opts.cell_style?opts.cell_style:{padding:'3px 0px'}));} this.run=function(callback,append){if(callback) this.onrun=callback;if(!append) -this.start=0;this.query=this.opts.get_query?this.opts.get_query():this.opts.query;this.add_limits();args={query_max:this.query_max||this.opts.query_max||''} -args.simple_query=this.query;args.as_dict=1;if(this.loading_img)$di(this.loading_img);wn.call({method:'webnotes.widgets.query_builder.runquery',args:args,callback:function(r,rt){me.make_results(r,rt)},no_spinner:this.opts.no_loading,btn:this.opts.run_btn});} +this.start=0;if(!this.opts.method){this.query=this.opts.get_query?this.opts.get_query():this.opts.query;this.add_limits();var args={query_max:this.query_max||this.opts.query_max||'',as_dict:1} +args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}} +if(this.loading_img)$di(this.loading_img);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:args,callback:function(r,rt){me.make_results(r,rt)},no_spinner:this.opts.no_loading,btn:this.opts.run_btn});} this.refresh=this.run;this.add_limits=function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);} if(opts)this.make();} /* @@ -1161,21 +1162,21 @@ $c('webnotes.widgets.page.getpage',{'name':page_name,stylesheets:JSON.stringify( /* * lib/js/legacy/wn/page_layout.js */ -wn.sidebar_background='#f2f2f2';wn.PageLayout=function(args){$.extend(this,args) -this.wrapper=$a(this.parent,'div','layout-wrapper',{backgroundColor:wn.sidebar_background,padding:'0px'});this.main=$a(this.wrapper,'div','layout-main-section');this.sidebar_area=$a(this.wrapper,'div','layout-side-section');$a(this.wrapper,'div','',{clear:'both'});this.head=$a(this.main,'div');this.toolbar_area=$a(this.main,'div');this.body=$a(this.main,'div');this.footer=$a(this.main,'div');if(this.heading){this.page_head=new PageHeader(this.head,this.heading);}} +wn.PageLayout=function(args){$.extend(this,args) +this.wrapper=$a(this.parent,'div','layout-wrapper layout-wrapper-background');this.main=$a(this.wrapper,'div','layout-main-section');this.sidebar_area=$a(this.wrapper,'div','layout-side-section');$a(this.wrapper,'div','',{clear:'both'});this.head=$a(this.main,'div');this.toolbar_area=$a(this.main,'div');this.body=$a(this.main,'div');this.footer=$a(this.main,'div');if(this.heading){this.page_head=new PageHeader(this.head,this.heading);}} /* * lib/js/legacy/wn/widgets/page_sidebar.js */ wn.widgets.PageSidebar=function(parent,opts){this.opts=opts this.sections={} -this.wrapper=$a(parent,'div','psidebar-wrapper') +this.wrapper=$a(parent,'div','psidebar') this.refresh=function(){this.wrapper.innerHTML='' if(this.opts.title) this.make_head();for(var i=0;i