diff --git a/public/build.json b/public/build.json index 92d00e338d..3ee5b60ae4 100644 --- a/public/build.json +++ b/public/build.json @@ -149,7 +149,6 @@ "lib/public/js/legacy/widgets/form/form_fields.js", "lib/public/js/legacy/widgets/form/print_format.js", "lib/public/js/legacy/widgets/form/clientscriptAPI.js", - "lib/public/js/legacy/widgets/form/form_comments.js", "lib/public/js/legacy/wn/widgets/form/sidebar.js", "lib/public/js/legacy/wn/widgets/form/comments.js", @@ -158,6 +157,8 @@ "lib/public/js/wn/form/editors.js", "lib/public/js/wn/form/grid.js", "lib/public/js/wn/form/attachments.js", + "lib/public/js/wn/form/footer.js", + "lib/public/js/wn/form/comments.js", "lib/public/js/wn/form/linked_with.js", "lib/public/js/wn/form/states.js", "lib/public/js/wn/form/assign_to.js", diff --git a/public/css/ui/common.css b/public/css/ui/common.css index 5ff29597fd..7519a1bb09 100644 --- a/public/css/ui/common.css +++ b/public/css/ui/common.css @@ -152,19 +152,31 @@ a { outline: none; } +/* form grid */ + .rows .grid-row .divider { padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid #dddddd; } -/*.rows .grid-row:last-child .divider { - border-bottom: 0px; - margin-bottom: 0px; - padding-bottom: 0px; -} -*/ .rows .grid-row .data-row, .rows .grid-row .panel-heading { cursor: pointer; } +/* form footer */ + +.form-footer { + background-color: #f2f2f2; + margin-top: 15px; + padding-top: 15px; + padding-bottom: 15px; + border-top: 1px dashed #ddd; + color: #888; +} + +.form-attachments { + border: 1px dashed #ddd; + padding: 15px; + padding-top: 0px; +} \ No newline at end of file diff --git a/public/images/ui/tick.gif b/public/images/ui/tick.gif deleted file mode 100644 index 9203c05c4a..0000000000 Binary files a/public/images/ui/tick.gif and /dev/null differ diff --git a/public/js/legacy/widgets/form/form.js b/public/js/legacy/widgets/form/form.js index f902317dea..37d279799b 100644 --- a/public/js/legacy/widgets/form/form.js +++ b/public/js/legacy/widgets/form/form.js @@ -30,10 +30,10 @@ + this.head + this.body + this.layout - + this.footer + this.sidebar + this.print_wrapper + this.head + + this.footer */ wn.provide('_f'); @@ -127,6 +127,11 @@ _f.Frm.prototype.setup = function() { this.setup_header(); + this.footer = new wn.ui.form.Footer({ + frm: this, + parent: this.layout_main + }) + this.setup_done = true; } @@ -136,7 +141,7 @@ _f.Frm.prototype.setup_print_layout = function() { this.print_wrapper = $('
\
\ \ - \ + \
\
\ \ @@ -172,7 +177,6 @@ _f.Frm.prototype.setup_std_layout = function() { this.main = this.form_wrapper; this.body_header = $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); @@ -192,9 +196,6 @@ _f.Frm.prototype.setup_std_layout = function() { this.states = new wn.ui.form.States({ frm: this }); - - // footer - this.setup_footer(); } _f.Frm.prototype.setup_header = function() { @@ -283,28 +284,6 @@ _f.Frm.prototype.setup_meta = function(doctype) { this.setup_print(); } -_f.Frm.prototype.setup_footer = function() { - var me = this; - - // footer toolbar - var f = this.footer; - - // save buttom - f.save_area = $a(this.footer,'div','',{display:'none', marginTop:'11px'}); - f.help_area = $a(this.footer,'div'); - - var b = $("") - .click(function() { me.save("Save", null, me); }).appendTo(f.save_area); - - // show / hide save - f.show_save = function() { - $ds(me.footer.save_area); - } - - f.hide_save = function() { - $dh(me.footer.save_area); - } -} _f.Frm.prototype.set_intro = function(txt) { wn.utils.set_intro(this, this.body, txt); @@ -493,9 +472,6 @@ _f.Frm.prototype.refresh = function(docname) { // dependent fields this.refresh_dependency(); - - // footer - this.refresh_footer(); // call onload post render for callbacks to be fired if(this.cscript.is_onload) { @@ -523,20 +499,6 @@ _f.Frm.prototype.refresh = function(docname) { } } -_f.Frm.prototype.refresh_footer = function() { - var f = this.footer; - if(f.save_area) { - // if save button is there in the header - if(this.frm_head && this.appframe.toolbar - && this.appframe.buttons.Save && !this.save_disabled - && (this.fields && this.fields.length > 7)) { - f.show_save(); - } else { - f.hide_save(); - } - } -} - _f.Frm.prototype.refresh_field = function(fname) { cur_frm.fields_dict[fname] && cur_frm.fields_dict[fname].refresh && cur_frm.fields_dict[fname].refresh(); diff --git a/public/js/legacy/widgets/form/form_grid.js b/public/js/legacy/widgets/form/form_grid.js deleted file mode 100644 index a7043483f1..0000000000 --- a/public/js/legacy/widgets/form/form_grid.js +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com) -// -// MIT License (MIT) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -_f.FormGrid = function(field) { - this.field = field; - this.doctype = field.df.options; - - if(!this.doctype) { - show_alert('No Options for table ' + field.df.label); - } - - this.col_break_width = cint(this.field.col_break_width); - if(!this.col_break_width) this.col_break_width = 100; - - $y(field.wrapper,{marginTop:'8px'}); - this.init(field.wrapper, field.df.width); - this.setup(); -} - -_f.FormGrid.prototype = new _f.Grid(); - -_f.FormGrid.prototype.setup = function() { - this.make_columns(); -} - -_f.FormGrid.prototype.make_buttons = function() { - var me = this; - this.tbar_btns = {}; - this.tbar_btns['Del'] = this.make_tbar_link($td(this.tbar_tab,0,0),wn._('Del'), - function() { me.delete_row(); }, 'icon-remove-sign'); - this.tbar_btns['Ins'] = this.make_tbar_link($td(this.tbar_tab,0,1),wn._('Ins'), - function() { me.insert_row(); }, 'icon-plus'); - this.tbar_btns['Up'] = this.make_tbar_link($td(this.tbar_tab,0,2),wn._('Up'), - function() { me.move_row(true); }, 'icon-arrow-up'); - this.tbar_btns['Dn'] = this.make_tbar_link($td(this.tbar_tab,0,3),wn._('Dn'), - function() { me.move_row(false); }, 'icon-arrow-down'); - - for(var i in this.btns) - this.btns[i].isactive = true; -} - -_f.FormGrid.prototype.make_tbar_link = function(parent, label, fn, icon) { - - var div = $a(parent,'div','',{cursor:'pointer'}); - var t = make_table(div, 1, 2, '90%', ['20px',null]); - var img = $a($td(t,0,0), 'i' , icon); - - $y($td(t,0,0),{textAlign:'right'}); - - var l = $a($td(t,0,1),'span','link_type',{color:'#333'}); - l.style.fontSize = '11px'; - l.innerHTML = label; - div.onclick = fn; - div.show = function() { $ds(this); } - div.hide = function() { $dh(this); } - - $td(t,0,0).isactive = 1; - $td(t,0,1).isactive = 1; - l.isactive = 1; - div.isactive = 1; - img.isactive = 1; - - return div; -} - -_f.FormGrid.prototype.make_columns = function() { - var p = this.field.perm; - if(p[this.field.df.permlevel] && p[this.field.df.permlevel][READ]) { // if read - var gl = wn.meta.docfield_list[this.field.df.options]; - - if(!gl) { - alert('Table details not found "'+this.field.df.options+'"'); - } - - gl.sort(function(a,b) { return a.idx - b.idx}); - - for(var i=0;i
').appendTo(this.parent); - this.$list = this.wrapper.find(".alert-list"); + this.$list = this.wrapper.find(".attachment-list"); this.parent.find(".btn").click(function() { me.new_attachment(); @@ -51,7 +51,7 @@ wn.ui.form.Attachments = Class.extend({ }, refresh: function() { var doc = this.frm.doc; - if(doc.__islocal || !this.frm.meta.allow_attach) { + if(doc.__islocal) { this.parent.toggle(false); return; } diff --git a/public/js/wn/form/states.js b/public/js/wn/form/states.js index 773843b70d..e22ac77ddf 100644 --- a/public/js/wn/form/states.js +++ b/public/js/wn/form/states.js @@ -131,8 +131,10 @@ wn.ui.form.States = Class.extend({ }); // disable the button if user cannot change state + var is_final = !$ul.find("li").length; this.workflow_button - .attr('disabled', $ul.find("li").length ? false : true); + .attr('disabled', is_final); + this.workflow_button.find(".caret").toggle(is_final ? false : true) }, set_default_state: function() { diff --git a/public/js/wn/form/toolbar.js b/public/js/wn/form/toolbar.js index 3dbdcf1a29..62eb499a12 100644 --- a/public/js/wn/form/toolbar.js +++ b/public/js/wn/form/toolbar.js @@ -14,11 +14,21 @@ wn.ui.form.Toolbar = Class.extend({ this.make_file_menu(); this.make_view_menu(); this.set_title_button(); + this.set_title_image(); this.show_title_as_dirty(); }, get_dropdown_menu: function(label) { return this.appframe.add_dropdown(label); }, + set_title_image: function() { + var img = this.frm.appframe.$w.find('.title-status-img').toggle(false); + if(this.frm.doc.docstatus==1) { + img.attr("src", "lib/images/ui/submitted.png").toggle(true); + } + else if(this.frm.doc.docstatus==2) { + img.attr("src", "lib/images/ui/cancelled.png").toggle(true); + } + }, make_file_menu: function() { var me = this; var p = this.frm.perm[0]; diff --git a/public/js/wn/ui/appframe.js b/public/js/wn/ui/appframe.js index a1881bf4a1..acbf5a6d31 100644 --- a/public/js/wn/ui/appframe.js +++ b/public/js/wn/ui/appframe.js @@ -17,6 +17,8 @@ wn.ui.AppFrame = Class.extend({ \ \
\ + \
\

\

\