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
';
- c.cur_label = label;
- break;
- }
- }
-}
-
-_f.FormGrid.prototype.get_children = function() {
- return getchildren(this.doctype, this.field.frm.docname, this.field.df.fieldname, this.field.frm.doctype);
-}
-
-_f.FormGrid.prototype.refresh = function() {
- var docset = this.get_children();
- var data = [];
-
- //alert(docset.length);
- for(var i=0; i*';
- r.is_newrow = true;
-}
-
-_f.FormGrid.prototype.check_selected = function() {
- if(!_f.cur_grid_cell) {
- show_alert(wn._('Select a cell first'));
- return false;
- }
- if(_f.cur_grid_cell.grid != this) {
- show_alert(wn._('Select a cell first'));
- return false;
- }
- return true;
-}
-
-_f.FormGrid.prototype.delete_row = function(dt, dn) {
- if(dt && dn) {
- wn.model.clear_doc(dt, dn);
- this.refresh();
- } else {
- if(!this.check_selected()) return;
- var r = _f.cur_grid_cell.row;
- if(r.is_newrow)return;
-
- var ci = _f.cur_grid_cell.cellIndex;
- var ri = _f.cur_grid_cell.row.rowIndex;
-
- wn.model.clear_doc(this.doctype, r.docname);
-
- this.refresh();
- if(ri < (this.tab.rows.length-1))
- this.cell_select(null, ri, ci);
- else _f.cur_grid_cell = null;
- }
- this.set_unsaved();
-
- if(this.on_row_delete) this.on_row_delete(cur_frm.doc, dt, dn);
-}
-
-_f.FormGrid.prototype.clear_table = function() {
- var me = this;
- $.each(this.get_children(), function(i, d) {
- wn.model.clear_doc(d.doctype, d.name);
- if(me.on_row_delete) me.on_row_delete(cur_frm.doc, d.doctype, d.name);
- });
- this.refresh();
- this.set_unsaved();
-}
-
-_f.FormGrid.prototype.move_row = function(up) {
-
- if(!this.check_selected()) return;
- var r = _f.cur_grid_cell.row;
- if(r.is_newrow)return;
-
- if(up && r.rowIndex > 0) {
- var swap_row = this.tab.rows[r.rowIndex - 1];
- } else if (!up) {
- var len = this.tab.rows.length;
- if(this.tab.rows[len-1].is_newrow)
- len = len - 1;
- if(r.rowIndex < (len-1))
- var swap_row = this.tab.rows[r.rowIndex + 1];
- }
-
- if(swap_row) {
- var cidx = _f.cur_grid_cell.cellIndex;
- this.cell_deselect();
-
- // swap index
- var aidx = locals[this.doctype][r.docname].idx;
- locals[this.doctype][r.docname].idx = locals[this.doctype][swap_row.docname].idx;
- locals[this.doctype][swap_row.docname].idx = aidx;
-
- // swap rows
- var adocname = swap_row.docname;
- this.refresh_row(swap_row.rowIndex, r.docname);
- this.refresh_row(r.rowIndex, adocname);
-
- this.cell_select(this.tab.rows[swap_row.rowIndex].cells[cidx]);
-
- this.set_unsaved();
- }
-}
diff --git a/public/js/legacy/widgets/form/grid.js b/public/js/legacy/widgets/form/grid.js
deleted file mode 100644
index 40435138a4..0000000000
--- a/public/js/legacy/widgets/form/grid.js
+++ /dev/null
@@ -1,492 +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.Grid
-
-_f.cur_grid_cell = null;
-_f.Grid = function(parent) { }
-
-_f.Grid.prototype.init = function(parent, row_height) {
-
- var me = this;
- this.col_idx_by_name = {}
- this.alt_row_bg = '#F2F2FF';
- this.row_height = row_height;
-
- // make the grid
- if(!row_height)this.row_height = '26px';
- this.make_ui(parent);
-
- // Sr No
- this.insert_column('', '', 'Int', 'Sr', '50px', '', [1,0,0]);
-
- if(this.oninit)this.oninit();
-
- // bind clicks
- $(this.wrapper).bind('keydown', function(e) {
- me.notify_keypress(e, e.which);
- })
-
- // reset grid heights after complete is triggerd on the form
- $(cur_frm.wrapper).bind('render_complete', function() {
- me.set_ht();
- });
-}
-
-_f.Grid.prototype.make_ui = function(parent) {
-
- var ht = make_table($a(parent, 'div'), 1, 2, '100%', ['55%','45%']);
- this.main_title = $td(ht,0,0); this.main_title.className = 'columnHeading';
- $td(ht,0,1).style.textAlign = 'right';
- this.tbar_div = $a($td(ht,0,1), 'div', 'grid_tbarlinks');
- this.tbar_tab = make_table(this.tbar_div,1,4,'100%',['25%','25%','25%','25%']);
-
- this.wrapper = $a(parent, 'div', 'grid_wrapper round');
-
- this.head_wrapper = $a(this.wrapper, 'div', 'grid_head_wrapper');
-
- this.head_tab = $a(this.head_wrapper, 'table', 'grid_head_table');
- this.head_row = this.head_tab.insertRow(0);
-
- this.tab_wrapper = $a(this.wrapper, 'div', 'grid_tab_wrapper');
- this.tab = $a(this.tab_wrapper, 'table', 'grid_table');
-
- var me = this;
-
- this.wrapper.onscroll = function() { me.head_wrapper.style.top = me.wrapper.scrollTop+'px'; }
-}
-
-_f.Grid.prototype.show = function() {
- if(this.can_edit && this.field.df['default'].toLowerCase()!='no toolbar') {
- $ds(this.tbar_div);
- if(this.can_add_rows) {
- $td(this.tbar_tab, 0, 0).style.display = 'table-cell';
- $td(this.tbar_tab, 0, 1).style.display = 'table-cell';
- } else {
- $td(this.tbar_tab, 0, 0).style.display = 'none';
- $td(this.tbar_tab, 0, 1).style.display = 'none';
- }
- } else {
- $dh(this.tbar_div);
- }
- $ds(this.wrapper);
-}
-_f.Grid.prototype.hide = function() {
- $dh(this.wrapper); $dh(this.tbar_div);
-}
-
-_f.Grid.prototype.insert_column = function(doctype, fieldname, fieldtype, label, width, options, perm, reqd, df) {
-
- var idx = this.head_row.cells.length;
- if(!width)width = '100px';
- if(fieldtype=="Currency" && cint(width) < 100) width = "100px";
- if(fieldtype=="Link" && cint(width) < 150) width = "150px";
- width= cint(width) + 'px';
-
- var col = this.head_row.insertCell(idx);
-
- col.df = df;
- col.doctype = doctype; // for report (fields may be from diff doctypes)
- col.fieldname = fieldname;
- col.fieldtype = fieldtype;
- $(col).attr("data-grid-fieldname", doctype + "-" + fieldname);
- col.innerHTML = wn._(label);
- col.title = label;
- col.label = label;
- if(reqd)
- col.style.color = "#D22";
-
- col.style.width = width;
- col.options = options;
- col.perm = perm;
-
- this.col_idx_by_name[fieldname] = idx;
-}
-
-_f.Grid.prototype.reset_table_width = function() {
- var w = 0;
- $.each(this.head_row.cells, function(i, cell) {
- if((cell.style.display || '').toLowerCase()!='none')
- w += cint(cell.style.width);
- })
-
- this.head_tab.style.width = w + 'px';
- this.tab.style.width = w + 'px';
-}
-
-_f.Grid.prototype.set_column_disp = function(fieldname, show) {
- var cidx = this.col_idx_by_name[fieldname];
- if(!cidx) {
- msgprint('Trying to hide unknown column: ' + fieldname);
- return;
- }
-
- var disp = show ? 'table-cell' : 'none';
-
- // head
- this.head_row.cells[cidx].style.display = disp;
-
- // body
- for(var i=0, len=this.tab.rows.length; i").html(cell.row.rowIndex + 1).appendTo(cell.div);
-
- $(cell.div).click(function() {
- if(me.can_edit) {
- me.cell_deselect();
- cell.div.style.border = '2px solid #88F';
- _f.cur_grid_cell = cell;
- }
- });
-
- if(this.can_edit) {
- $("")
- .click(function() {
- _f.cur_grid = me;
- _f.cur_grid_ridx = cell.row.rowIndex;
- _f.edit_record(me.doctype, cell.row.docname, 1);
- })
- .css({"margin-left": "4px"})
- .appendTo(cell.div)
- }
- }
-}
-
-// if clicked on whitespace
-// and a grid cell is selected
-// deselect the cell
-$(document).bind('click', function(e) {
- var me = this;
- var is_target_toolbar = function() {
- return $(e.target).parents('.grid_tbarlinks').length;
- }
-
- var is_target_input = function() {
- // select opened
- if(e.target.tagName.toLowerCase()=='option') return true;
-
- // autosuggest openend
- //if(wn._autosugg_open) return true;
-
- return $(e.target).parents().get().indexOf(_f.cur_grid_cell)!=-1;
- }
-
- if(_f.cur_grid_cell && !is_target_input() && !is_target_toolbar()) {
- if(!(text_dialog && text_dialog.display)
- && !datepicker_active && !(selector && selector.display)) {
- setTimeout('_f.cur_grid_cell.grid.cell_deselect()', 500);
- return false;
- }
- }
-});
-
-_f.Grid.prototype.cell_deselect = function() {
- if(_f.cur_grid_cell) {
- var c = _f.cur_grid_cell;
- c.grid.remove_template(c);
- c.div.className = 'grid_cell_div';
- if(c.is_odd) c.div.style.border = '2px solid ' + c.grid.alt_row_bg;
- else c.div.style.border = '2px solid #FFF';
- _f.cur_grid_cell = null;
- }
-}
-
-_f.Grid.prototype.cell_select = function(cell, ri, ci) {
- if(cell && _f.cur_grid_cell==cell && cell.hc) return;
-
- if(ri!=null && ci!=null)
- cell = this.tab.rows[ri].cells[ci];
-
- var hc = this.head_row.cells[cell.cellIndex];
-
- if(!hc.doctype) return;
-
- if(!hc.template) {
- this.make_template(hc);
- }
-
- hc.template.perm = this.field ? this.field.perm : hc.perm; // get latest permissions
-
- if(hc.fieldname && hc.template.get_status()=='Write') {
- this.cell_deselect();
- cell.div.style.border = '2px solid #88F';
- _f.cur_grid_cell = cell;
- this.add_template(cell);
- }
-}
-
-_f.Grid.prototype.add_template = function(cell) {
- if(!cell.row.docname && this.add_newrow) { // activate new row here
- this.add_newrow();
- this.cell_select(cell);
- } else {
- var hc = this.head_row.cells[cell.cellIndex];
- cell.div.innerHTML = '';
- cell.div.appendChild(hc.template.wrapper);
- hc.template.activate(cell.row.docname);
- hc.template.activated=1;
- cell.hc = hc;
-
- if(hc.template.input && hc.template.input.set_width) {
- hc.template.input.set_width($(cell).width());
- }
- }
-}
-
-_f.Grid.prototype.get_field = function(fieldname) { // get template
- for(var i=0;i=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: // up
- if (ri > 0) {
- this.cell_select('', ri - 1, ci);
- } break;
- case 40: // down
- if (ri < (this.tab.rows.length - 1)) {
- this.cell_select('', ri + 1, ci);
- } break;
- case 39: // right
- if (ci < (this.head_row.cells.length - 1)) {
- this.cell_select('', ri, ci + 1);
- } break;
- case 37: // left
- if (ci > 1) {
- this.cell_select('', ri, ci - 1);
- } break;
- }
-}
-
-_f.Grid.prototype.make_template = function(hc) {
- hc.template = make_field(wn.meta.get_docfield(hc.doctype, hc.fieldname), hc.doctype,
- '', this.field.frm, true);
- hc.template.grid = this;
-}
-
-_f.Grid.prototype.append_rows = function(n) {
- for(var i=0;i this.tab.rows.length)
- this.append_rows(data.length - this.tab.rows.length);
-
- // truncate if reqd
- if(data.length < this.tab.rows.length)
- this.truncate_rows(this.tab.rows.length - data.length);
-
- // set data
- for(var ridx=0;ridx max_ht) ht = max_ht;
-
- ht += 4;
- $y(this.wrapper,{height:ht+'px'});
-}
-
-_f.Grid.prototype.refresh_row = function(ridx, docname) {
- var row = this.tab.rows[ridx];
- row.docname = docname;
- row.is_newrow = false;
-
- for(var cidx=0; cidx\
- \
+ \
\
').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({
\
\