diff --git a/build.json b/build.json index 9c977b7f5c..dc6613803e 100644 --- a/build.json +++ b/build.json @@ -97,6 +97,7 @@ "lib/js/legacy/utils/dom.js", "lib/js/legacy/utils/handler.js", "lib/js/legacy/utils/msgprint.js", + "lib/js/wn/ui/appframe.js", "lib/js/wn/ui/dialog.js", "lib/js/legacy/widgets/dialog.js", "lib/js/wn/ui/listing.js", @@ -131,7 +132,7 @@ "lib/js/legacy/utils/msgprint.js", "lib/js/legacy/utils/printElement.js", "lib/js/legacy/widgets/form/fields.js", - "lib/js/wn/views/appframe.js", + "lib/js/wn/ui/appframe.js", "lib/js/wn/ui/dialog.js", "lib/js/wn/ui/button.js", "lib/js/legacy/widgets/dialog.js", diff --git a/css/all-app.css b/css/all-app.css index 85bea74aea..a87b4baa8e 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -330,7 +330,7 @@ div.notice { div.form-title { /*background-color: #e0eeff;*/ - padding: 5px 11px 15px 11px; + padding: 5px 19px 15px 19px; margin: -15px -15px 0px -15px; border-bottom: 1px solid #eee; } @@ -338,7 +338,7 @@ div.form-title { div.form-section-head { margin: 11px -15px 3px -15px; border-top: 1px solid #ccc; - padding: 11px 15px 0px 15px; + padding: 11px 23px 0px 23px; } div.form-layout-row:first-child .form-section-head { diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py index 2ff5a1fa43..5be3809ee3 100644 --- a/erpnext/accounts/doctype/gl_control/gl_control.py +++ b/erpnext/accounts/doctype/gl_control/gl_control.py @@ -450,43 +450,6 @@ class DocType: if not ret: msgprint("Payment Entry has been modified after you pulled it. Please pull it again.", raise_exception=1) -###################################################################################################################### - - - - # Repair Outstanding Amount - #--------------------------------- - def repair_voucher_outstanding(self, voucher_obj): - msg = [] - - # Get Balance from GL Entries - bal = webnotes.conn.sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (voucher_obj.doc.name , voucher_obj.doc.doctype)) - bal = bal and flt(bal[0][0]) or 0.0 - if cstr(voucher_obj.doc.doctype) == 'Purchase Invoice': - bal = -bal - - # Check outstanding Amount - if flt(voucher_obj.doc.outstanding_amount) != flt(bal): - msgprint('
Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s)
' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal)) - msg.append('
Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s)
' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal)) - - # set voucher balance - #webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (voucher_obj.doc.doctype, bal, voucher_obj.doc.name)) - webnotes.conn.set(voucher_obj.doc, 'outstanding_amount', flt(bal)) - - # Send Mail - if msg: - email_msg = """ Dear Administrator, - -In Account := %s User := %s has Repaired Outstanding Amount For %s : %s and following was found:- - -%s - -""" % (webnotes.conn.get_value('Control Panel', None,'account_id'), session['user'], voucher_obj.doc.doctype, voucher_obj.doc.name, '\n'.join(msg)) - - sendmail(['support@iwebnotes.com'], subject='Repair Outstanding Amount', parts = [('text/plain', email_msg)]) - # Acknowledge User - msgprint(cstr(voucher_obj.doc.doctype) + " : " + cstr(voucher_obj.doc.name) + " has been checked" + cstr(msg and " and repaired successfully." or ". No changes Found.")) def repost_illegal_cancelled(self, after_date='2011-01-01'): """ diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 9b3968da2a..be62c93b24 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -558,8 +558,3 @@ class DocType(TransactionBase): def on_update(self): pass -######################################################################## -# Repair Outstanding -####################################################################### - def repair_pv_outstanding(self): - get_obj(dt = 'GL Control').repair_voucher_outstanding(self) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 0a25feb104..a2d9f6a753 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -79,7 +79,7 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) { 'source', 'cancel_reason', 'total_advance', 'gross_profit', 'gross_profit_percent', 'get_advances_received', 'advance_adjustment_details', 'sales_partner', 'commission_rate', - 'total_commission', 'repair_outstanding_amt']; + 'total_commission']; item_flds_normal = ['sales_order', 'delivery_note'] item_flds_pos = ['warehouse', 'serial_no', 'batch_no', 'actual_qty', 'delivered_qty'] @@ -115,7 +115,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { if(doc.docstatus==1) { cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry); cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); - unhide_field('repair_outstanding_amt'); if(doc.is_pos==1 && doc.update_stock!=1) cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']); @@ -123,8 +122,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { if(doc.outstanding_amount!=0) cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher); } - else - hide_field('repair_outstanding_amt'); } //fetch retail transaction related fields diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index d89ff042d1..6c956a0dae 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -679,13 +679,6 @@ class DocType(TransactionBase): webnotes.conn.set(self.doc,'outstanding_amount',flt(self.doc.grand_total) - flt(self.doc.total_advance) - flt(self.doc.paid_amount) - flt(self.doc.write_off_amount)) -######################################################################## -# Repair Outstanding - - def repair_rv_outstanding(self): - get_obj(dt = 'GL Control').repair_voucher_outstanding(self) - - #------------------------------------------------------------------------------------- def on_update_after_submit(self): self.convert_into_recurring() diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt index 7466d4e794..c851e75952 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:47', + 'creation': '2012-04-11 13:17:25', 'docstatus': 0, - 'modified': '2012-03-27 18:44:28', + 'modified': '2012-04-13 11:26:44', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -13,6 +13,7 @@ # These values are common for all DocType { '_last_update': u'1330671142', + 'allow_attach': 1, 'change_log': u'1. Change in pull_details method dt.-26-06-2009', 'colour': u'White:FFF', 'default_print_format': u'Standard', @@ -26,7 +27,7 @@ 'server_code_error': u' ', 'show_in_menu': 0, 'subject': u'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding', - 'version': 417 + 'version': 418 }, # These values are common for all DocField @@ -54,6 +55,30 @@ 'name': u'Sales Invoice' }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Accounts Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts Manager', + 'submit': 1, + 'write': 1 + }, + # DocPerm { 'amend': 1, @@ -80,38 +105,10 @@ # DocPerm { - 'amend': 0, - 'cancel': 0, - 'create': 0, 'doctype': u'DocPerm', + 'match': u'customer', 'permlevel': 0, - 'role': u'Customer', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Accounts Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Accounts Manager', - 'submit': 1, - 'write': 1 + 'role': u'Customer' }, # DocField @@ -1503,14 +1500,13 @@ # DocField { - 'allow_on_submit': 1, 'doctype': u'DocField', - 'fieldname': u'repair_outstanding_amt', - 'fieldtype': u'Button', - 'label': u'Repair Outstanding Amt', - 'oldfieldtype': u'Button', - 'options': u'repair_rv_outstanding', + 'fieldname': u'file_list', + 'fieldtype': u'Text', + 'hidden': 1, + 'label': u'File List', + 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 } -] +] \ No newline at end of file diff --git a/erpnext/accounts/page/accounts_home/accounts_home.html b/erpnext/accounts/page/accounts_home/accounts_home.html index a2033ec174..398f1e46f3 100644 --- a/erpnext/accounts/page/accounts_home/accounts_home.html +++ b/erpnext/accounts/page/accounts_home/accounts_home.html @@ -1,19 +1,22 @@
+
- ×

Accounts


Journal Voucher

General Ledger Entries

+

Sales Invoice

Bills raised to Customers

+

Purchase Invoice

Bills raised by Suppliers

Chart of Accounts

Structure of books of accounts

+

Chart of Cost Centers

Structure cost centers

diff --git a/erpnext/accounts/page/accounts_home/accounts_home.js b/erpnext/accounts/page/accounts_home/accounts_home.js index 52738a83bd..9915226f86 100644 --- a/erpnext/accounts/page/accounts_home/accounts_home.js +++ b/erpnext/accounts/page/accounts_home/accounts_home.js @@ -16,6 +16,8 @@ pscript['onload_accounts-home'] = function(wrapper) { erpnext.module_page.setup_page('Accounts', wrapper); + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); + if(wn.control_panel.country!='India') { $('.india-specific').toggle(false); } diff --git a/erpnext/buying/doctype/purchase_request/purchase_request.js b/erpnext/buying/doctype/purchase_request/purchase_request.js index c693bf3818..d20d50aeea 100644 --- a/erpnext/buying/doctype/purchase_request/purchase_request.js +++ b/erpnext/buying/doctype/purchase_request/purchase_request.js @@ -60,13 +60,13 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { } if(!is_closed) { cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order']) - cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Requisition']) + cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Request']) } cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); } if(doc.docstatus == 1 && doc.status == 'Stopped') - cur_frm.add_custom_button('Unstop Purchase Request', cur_frm.cscript['Unstop Purchase Requisition']) + cur_frm.add_custom_button('Unstop Purchase Request', cur_frm.cscript['Unstop Purchase Request']) } //======================= validation =================================== @@ -108,7 +108,7 @@ cur_frm.cscript['Make Purchase Order'] = function() { // Stop INDENT // ================================================================================================== -cur_frm.cscript['Stop Purchase Requisition'] = function() { +cur_frm.cscript['Stop Purchase Request'] = function() { var doc = cur_frm.doc; var check = confirm("Do you really want to STOP this Purchase Request?"); @@ -121,7 +121,7 @@ cur_frm.cscript['Stop Purchase Requisition'] = function() { // Un Stop INDENT //==================================================================================================== -cur_frm.cscript['Unstop Purchase Requisition'] = function(){ +cur_frm.cscript['Unstop Purchase Request'] = function(){ var doc = cur_frm.doc var check = confirm("Do you really want to UNSTOP this Purchase Request?"); diff --git a/erpnext/buying/page/buying_home/buying_home.html b/erpnext/buying/page/buying_home/buying_home.html index ef521aa4f8..ee10d10c28 100644 --- a/erpnext/buying/page/buying_home/buying_home.html +++ b/erpnext/buying/page/buying_home/buying_home.html @@ -1,17 +1,19 @@
+
- ×

Buying


Purchase Request

Request for purchase

+

Purchase Order

Purchase Orders given to Suppliers

Supplier

Supplier Master

+

Item

Item Master

diff --git a/erpnext/buying/page/buying_home/buying_home.js b/erpnext/buying/page/buying_home/buying_home.js index 1f47b84629..646ed0b178 100644 --- a/erpnext/buying/page/buying_home/buying_home.js +++ b/erpnext/buying/page/buying_home/buying_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_buying-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Buying', wrapper); } \ No newline at end of file diff --git a/erpnext/hr/page/hr_home/hr_home.html b/erpnext/hr/page/hr_home/hr_home.html index 007ee769d4..b49ce092d7 100644 --- a/erpnext/hr/page/hr_home/hr_home.html +++ b/erpnext/hr/page/hr_home/hr_home.html @@ -1,17 +1,21 @@
+
- ×

Human Resources


Attendance

Attendance Mark

+

Leave Application

Applications for leave

+

Expense Claim

Claims for expenses

+

Salary Slip

Monthly salary statement

+

Appraisal

Performance appraisal

diff --git a/erpnext/hr/page/hr_home/hr_home.js b/erpnext/hr/page/hr_home/hr_home.js index 418ed57518..1971b4690b 100644 --- a/erpnext/hr/page/hr_home/hr_home.js +++ b/erpnext/hr/page/hr_home/hr_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_hr-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('HR', wrapper); } \ No newline at end of file diff --git a/erpnext/production/page/production_home/production_home.html b/erpnext/production/page/production_home/production_home.html index 7a20097fc7..77d80193e2 100644 --- a/erpnext/production/page/production_home/production_home.html +++ b/erpnext/production/page/production_home/production_home.html @@ -1,17 +1,19 @@
+
- ×

Production


Production Order

Orders for manufacturing

+

Production Plan

Generate Purchase Requisition (MRP) and Production Orders

Bill of Materials

Bill of Materials (BOM) Master

+

Item

Item Master

diff --git a/erpnext/production/page/production_home/production_home.js b/erpnext/production/page/production_home/production_home.js index 5367815edc..af4ba9db9e 100644 --- a/erpnext/production/page/production_home/production_home.js +++ b/erpnext/production/page/production_home/production_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_production-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Production', wrapper); } \ No newline at end of file diff --git a/erpnext/projects/page/projects_home/projects_home.html b/erpnext/projects/page/projects_home/projects_home.html index 0cb760e7b1..e86aa03d98 100644 --- a/erpnext/projects/page/projects_home/projects_home.html +++ b/erpnext/projects/page/projects_home/projects_home.html @@ -1,13 +1,15 @@
+
- ×

Projects


Project

Project master

+

Task

Project activity / task

+

Timesheet

Timesheet for tasks

diff --git a/erpnext/projects/page/projects_home/projects_home.js b/erpnext/projects/page/projects_home/projects_home.js index 73d6e3303c..187fc57825 100644 --- a/erpnext/projects/page/projects_home/projects_home.js +++ b/erpnext/projects/page/projects_home/projects_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_projects-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Projects', wrapper); } \ No newline at end of file diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index dbfd3916fb..a18f079d88 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -77,7 +77,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { // indent if(doc.order_type != 'Maintenance') - cur_frm.add_custom_button('Make ' + get_doctype_label('Purchase Request'), cur_frm.cscript['Make Purchase Requisition']); + cur_frm.add_custom_button('Make ' + get_doctype_label('Purchase Request'), cur_frm.cscript['Make Purchase Request']); // sales invoice if(doc.per_billed < 100) @@ -92,9 +92,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']); } - unhide_field(['repair_sales_order', 'Send SMS', 'message', 'customer_mobile_no']) + unhide_field(['Send SMS', 'message', 'customer_mobile_no']) } else { - hide_field(['repair_sales_order', 'Send SMS', 'message', 'customer_mobile_no']) + hide_field(['Send SMS', 'message', 'customer_mobile_no']) } } @@ -263,7 +263,7 @@ cur_frm.cscript.make_maintenance_visit = function() { // make indent // ================================================================================================ -cur_frm.cscript['Make Purchase Requisition'] = function() { +cur_frm.cscript['Make Purchase Request'] = function() { var doc = cur_frm.doc; if (doc.docstatus == 1) { n = createLocal("Purchase Request"); diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 3270f988ce..6fa737c58f 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -509,7 +509,3 @@ class DocType(TransactionBase): def on_update(self): pass - # Repair Sales Order - # =========================================== - def repair_sales_order(self): - get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self) diff --git a/erpnext/selling/doctype/sales_order/sales_order.txt b/erpnext/selling/doctype/sales_order/sales_order.txt index eb17cffbe9..af3d9b5585 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.txt +++ b/erpnext/selling/doctype/sales_order/sales_order.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:14', + 'creation': '2012-04-11 13:18:19', 'docstatus': 0, - 'modified': '2012-03-27 18:49:05', + 'modified': '2012-04-13 11:32:08', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -13,7 +13,7 @@ # These values are common for all DocType { '_last_update': u'1330670942', - 'allow_attach': 0, + 'allow_attach': 1, 'colour': u'White:FFF', 'default_print_format': u'Standard', 'doctype': 'DocType', @@ -30,7 +30,7 @@ 'show_in_menu': 0, 'subject': u'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed', 'tag_fields': u'delivery_status,billing_status', - 'version': 632 + 'version': 633 }, # These values are common for all DocField @@ -58,6 +58,30 @@ 'name': u'Sales Order' }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'submit': 1, + 'write': 1 + }, + # DocPerm { 'amend': 1, @@ -70,18 +94,6 @@ 'write': 1 }, - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Maintenance User', - 'submit': 1, - 'write': 1 - }, - # DocPerm { 'amend': 0, @@ -89,93 +101,63 @@ 'create': 0, 'doctype': u'DocPerm', 'permlevel': 1, - 'role': u'Maintenance Manager', + 'role': u'Sales User', 'submit': 0, 'write': 0 }, # DocPerm { - 'amend': 1, - 'cancel': 1, - 'create': 1, 'doctype': u'DocPerm', + 'match': u'customer_name', 'permlevel': 0, - 'role': u'Maintenance Manager', - 'submit': 1, - 'write': 1 + 'role': u'Customer' }, # DocPerm { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, 'doctype': u'DocPerm', 'permlevel': 2, 'role': u'Accounts User', - 'submit': 0, 'write': 1 }, # DocPerm { - 'amend': 0, - 'cancel': 0, - 'create': 0, + 'amend': 1, + 'cancel': 1, + 'create': 1, 'doctype': u'DocPerm', 'permlevel': 0, - 'role': u'Customer', - 'submit': 0, - 'write': 0 + 'role': u'Maintenance Manager', + 'submit': 1, + 'write': 1 }, # DocPerm { - 'amend': 0, - 'cancel': 0, - 'create': 0, 'doctype': u'DocPerm', 'permlevel': 1, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 + 'role': u'Maintenance Manager' }, # DocPerm { - 'amend': 0, - 'cancel': 0, - 'create': 0, + 'amend': 1, + 'cancel': 1, + 'create': 1, 'doctype': u'DocPerm', - 'permlevel': 1, + 'permlevel': 0, 'role': u'Maintenance User', - 'submit': 0, - 'write': 0 + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Maintenance User' }, # DocField @@ -1335,14 +1317,13 @@ # DocField { - 'allow_on_submit': 1, 'doctype': u'DocField', - 'fieldname': u'repair_sales_order', - 'fieldtype': u'Button', - 'label': u'Repair Sales Order', - 'oldfieldtype': u'Button', - 'options': u'repair_sales_order', + 'fieldname': u'file_list', + 'fieldtype': u'Text', + 'hidden': 1, + 'label': u'File List', + 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 } -] +] \ 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 index ce45e52184..e6865526cc 100644 --- a/erpnext/selling/page/selling_home/selling_home.html +++ b/erpnext/selling/page/selling_home/selling_home.html @@ -1,21 +1,25 @@
+
- ×

Selling


Lead

Prospective customers

+

Opportunity

Business opportunities

+

Quotation

Quotes sent to Leads / Customers

+

Sales Order

Confirmed orders from Customers

Customer

Customer Master

+

Item

Item Master

diff --git a/erpnext/selling/page/selling_home/selling_home.js b/erpnext/selling/page/selling_home/selling_home.js index e0430d73bc..2561ee4645 100644 --- a/erpnext/selling/page/selling_home/selling_home.js +++ b/erpnext/selling/page/selling_home/selling_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_selling-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Selling', wrapper); } \ No newline at end of file diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 8e158979e6..99c0a73dbb 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -64,10 +64,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if(doc.per_installed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']); if (doc.docstatus!=1) { - hide_field(['SMS', 'Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']); + hide_field(['Send SMS', 'message', 'customer_mobile_no'); } else { cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); - unhide_field(['SMS','Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']); + unhide_field(['Send SMS', 'message', 'customer_mobile_no'); } if(doc.docstatus==0 && !doc.__islocal) { diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 49d70325b4..ffa656231f 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -487,8 +487,4 @@ class DocType(TransactionBase): self.set_actual_qty() get_obj('Stock Ledger').scrub_serial_nos(self) - # Repair Delivery Note - # =========================================== - def repair_delivery_note(self): - get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt index 9c536cc0f2..d29acf5442 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.txt +++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:28', + 'creation': '2012-04-11 13:18:36', 'docstatus': 0, - 'modified': '2012-03-27 18:50:57', + 'modified': '2012-04-13 11:02:43', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -13,6 +13,7 @@ # These values are common for all DocType { '_last_update': u'1330593645', + 'allow_attach': 1, 'colour': u'White:FFF', 'default_print_format': u'Standard', 'doctype': 'DocType', @@ -29,7 +30,7 @@ 'show_in_menu': 0, 'subject': u'To %(customer_name)s on %(posting_date)s | %(per_billed)s% billed', 'tag_fields': u'billing_status', - 'version': 476 + 'version': 477 }, # These values are common for all DocField @@ -57,6 +58,78 @@ 'name': u'Delivery Note' }, + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + # DocPerm { 'cancel': 0, @@ -75,30 +148,6 @@ 'role': u'Accounts User' }, - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - # DocPerm { 'doctype': u'DocPerm', @@ -115,54 +164,6 @@ 'write': 1 }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material User', - 'submit': 1, - 'write': 1 - }, - # DocField { 'colour': u'White:FFF', @@ -1368,14 +1369,13 @@ # DocField { - 'allow_on_submit': 1, 'doctype': u'DocField', - 'fieldname': u'repair_delivery_note', - 'fieldtype': u'Button', - 'label': u'Repair Delivery Note', - 'oldfieldtype': u'Button', - 'options': u'repair_delivery_note', + 'fieldname': u'file_list', + 'fieldtype': u'Text', + 'hidden': 1, + 'label': u'File List', + 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 } -] +] \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 07e83edc14..3f371738b0 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -26,8 +26,8 @@ var cfn_set_fields = function(doc, cdt, cdn) { hide_field(lst); if (doc.purpose == 'Production Order' || doc.purpose == 'Other'){ - unhide_field('Get Items'); - hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','Warehouse HTML', 'transporter', 'is_excisable_goods', 'excisable_goods']); + unhide_field('get_items'); + hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','warehouse_html', 'transporter', 'is_excisable_goods', 'excisable_goods']); if (doc.purpose=='Production Order') unhide_field(['production_order', 'process']); doc.from_warehouse = ''; @@ -42,7 +42,7 @@ var cfn_set_fields = function(doc, cdt, cdn) { } else{ unhide_field(['from_warehouse', 'to_warehouse']); - hide_field(['production_order', 'process', 'Get Items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']); + hide_field(['production_order', 'process', 'get_items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']); doc.production_order = ''; doc.process = ''; doc.fg_completed_qty = 0; diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js index a297e0badb..941b863cfd 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js @@ -15,7 +15,7 @@ // along with this program. If not, see . cur_frm.cscript.refresh = function(doc) { - if (doc.docstatus) hide_field('Steps'); + if (doc.docstatus) hide_field('steps'); } cur_frm.cscript.download_template = function(doc, cdt, cdn) { diff --git a/erpnext/stock/doctype/warehouse/warehouse.txt b/erpnext/stock/doctype/warehouse/warehouse.txt index 2af4eacb0e..2deacf0f61 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.txt +++ b/erpnext/stock/doctype/warehouse/warehouse.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:40', + 'creation': '2012-04-11 13:18:57', 'docstatus': 0, - 'modified': '2012-03-27 14:36:40', + 'modified': '2012-04-11 17:47:35', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -25,7 +25,7 @@ 'section_style': u'Tabbed', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 58 + 'version': 59 }, # These values are common for all DocField @@ -53,6 +53,78 @@ 'name': u'Warehouse' }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + # DocPerm { 'doctype': u'DocPerm', @@ -81,91 +153,19 @@ # DocPerm { - 'create': 0, + 'cancel': 1, + 'create': 1, 'doctype': u'DocPerm', - 'permlevel': 2, + 'permlevel': 0, 'role': u'System Manager', 'write': 1 }, # DocPerm { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, 'create': 0, 'doctype': u'DocPerm', 'permlevel': 2, - 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 2, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, 'role': u'System Manager', 'write': 1 }, @@ -268,7 +268,7 @@ { 'doctype': u'DocField', 'fieldname': u'phone_no', - 'fieldtype': u'Int', + 'fieldtype': u'Data', 'label': u'Phone No', 'oldfieldname': u'phone_no', 'oldfieldtype': u'Int', @@ -280,7 +280,7 @@ { 'doctype': u'DocField', 'fieldname': u'mobile_no', - 'fieldtype': u'Int', + 'fieldtype': u'Data', 'label': u'Mobile No', 'oldfieldname': u'mobile_no', 'oldfieldtype': u'Int', diff --git a/erpnext/stock/page/stock_home/stock_home.html b/erpnext/stock/page/stock_home/stock_home.html index aede4e3552..d1b2507df1 100644 --- a/erpnext/stock/page/stock_home/stock_home.html +++ b/erpnext/stock/page/stock_home/stock_home.html @@ -1,23 +1,28 @@
+
- ×

Stock


Stock Entry

Transfer stock from one warehouse to another

+

Delivery Note

Delivery (shipment) to customers

+

Purchase Receipt

Goods received from Suppliers

Item

Item Master

+

Serial No

Single unit of an Item

+

Batch

Batch of units of an Item

+

Warehouse

Warehouse is where items are stored

diff --git a/erpnext/stock/page/stock_home/stock_home.js b/erpnext/stock/page/stock_home/stock_home.js index aa33722098..7df9b275e9 100644 --- a/erpnext/stock/page/stock_home/stock_home.js +++ b/erpnext/stock/page/stock_home/stock_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_stock-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Stock', wrapper); } \ No newline at end of file diff --git a/erpnext/support/doctype/customer_issue/customer_issue.js b/erpnext/support/doctype/customer_issue/customer_issue.js index cb909ac4ac..699c97f637 100644 --- a/erpnext/support/doctype/customer_issue/customer_issue.js +++ b/erpnext/support/doctype/customer_issue/customer_issue.js @@ -22,8 +22,8 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){ } cur_frm.cscript.refresh = function(doc,ct,cdn){ - if(!doc.docstatus) hide_field('Make Maintenance Visit'); - else if(doc.docstatus && (doc.status == 'Open' || doc.status == 'Work In Progress')) unhide_field('Make Maintenance Visit'); + if(!doc.docstatus) hide_field('make_maintenance_visit'); + else if(doc.docstatus && (doc.status == 'Open' || doc.status == 'Work In Progress')) unhide_field('make_maintenance_visit'); } diff --git a/erpnext/support/page/support_home/support_home.html b/erpnext/support/page/support_home/support_home.html index 6c1f790b48..dcabe1ce95 100644 --- a/erpnext/support/page/support_home/support_home.html +++ b/erpnext/support/page/support_home/support_home.html @@ -1,15 +1,18 @@
+
- ×

Support


Support Ticket

Support queries from customers via email or website

+

Customer Issue

Customer Issue against a Serial No (warranty)

+

Maintenance Schedule

Plan for scheduled maintenance contracts

+

Maintenance Visit

Visit report for maintenance visit

diff --git a/erpnext/support/page/support_home/support_home.js b/erpnext/support/page/support_home/support_home.js index b9fd85e390..3b95eb652a 100644 --- a/erpnext/support/page/support_home/support_home.js +++ b/erpnext/support/page/support_home/support_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_support-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Support', wrapper); } \ No newline at end of file diff --git a/erpnext/website/page/website_home/website_home.html b/erpnext/website/page/website_home/website_home.html index f7bb208bea..3252282510 100644 --- a/erpnext/website/page/website_home/website_home.html +++ b/erpnext/website/page/website_home/website_home.html @@ -1,25 +1,25 @@
+
- ×

Website


Web Page

Static (content) web page

+

Product

Product listed in catolog

+

Blog

Weblog (blog) entry

Website Settings

Setup of top navigation bar, footer and logo

-
-
+

Style Settings

Setup of fonts and background

-
-
+

Products Settings

Setup product categories

diff --git a/erpnext/website/page/website_home/website_home.js b/erpnext/website/page/website_home/website_home.js index ec6053f305..51f12baaa7 100644 --- a/erpnext/website/page/website_home/website_home.js +++ b/erpnext/website/page/website_home/website_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_website-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Website', wrapper); } \ No newline at end of file diff --git a/js/all-app.js b/js/all-app.js index 6db411f8c5..f715dc09b6 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -263,13 +263,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \
\ -
\ - \ - Refresh\ - \ - New\ - \ - Filter\ +
\
\
\ More...
\
\
\ - ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){this.make_filters();}},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} -if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();} -if(!me.show_filters){this.$w.find('.btn-filter').remove();} -if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();} -this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') + ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.appframe){this.$w.find('.list-toolbar-wrapper').toggle(false);} +if(this.show_filters){this.make_filters();}},add_button:function(label,click,icon){if(this.appframe){return this.appframe.add_button(label,click,icon)}else{$button=$('').appendTo(this.$w.find('.list-toolbar')) +if(icon){$('').addClass(icon).appendTo($button);} +$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} +if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');} +if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');} +if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') this.onrun=a0;if(a0&&a0.callback) this.onrun=a0.callback;if(!a1&&!(a0&&a0.append)) this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} @@ -304,8 +300,8 @@ if(this.get_args){$.extend(args,this.get_args());} return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}} if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length) -this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.listobj.$w.find('.btn-filter').bind('click',function(){me.$w.find('.show_filters').slideToggle();if(!me.filters.length) -me.add_filter();});this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) +this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length) +this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) values.push(f.get_value());}) return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);}) this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname) @@ -374,7 +370,7 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doct
\
\
\ -
',{label:this.label}));this.appframe=new wn.views.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1 +
',{label:this.label}));this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1 else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);} this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.$page.find('.wnlist-area'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,no_result_message:this.make_no_result(),columns:this.listview.fields});this.run();},make_no_result:function(){return repl('

No %(doctype_label)s found

\ %(description)s\ @@ -382,8 +378,7 @@ this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.wid

\ -

',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('\ - Delete',function(){me.delete_items();},'.btn-filter')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) +

',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;} me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('

Tags

\ @@ -913,15 +908,15 @@ if(frm){f.frm=frm;if(parent) f.layout_cell=parent.parentNode;} if(f.init)f.init();f.make_body();return f;} /* - * lib/js/wn/views/appframe.js + * lib/js/wn/ui/appframe.js */ -wn.views.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('
').appendTo(parent);this.$titlebar=$('
\ +wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('
').appendTo(parent);this.$titlebar=$('
\ \ ×\
').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length) this.$w.append('
');args={label:label,icon:''};if(icon){args.icon='';} this.buttons[label]=$(repl('',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}}) + %(icon)s %(label)s',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}}) /* * lib/js/wn/ui/dialog.js */ @@ -939,7 +934,7 @@ wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=fun this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width) this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields) this.make_fields(this.body,this.opts.fields);} -this.make_head=function(){var me=this;this.appframe=new wn.views.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);} +this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);} this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');} this.set_postion=function(){var d=get_screen_dims();this.wrapper.style.left=((d.w-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=(get_scroll_top()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});} this.show=function(){if(this.display)return;this.set_postion() @@ -1612,7 +1607,7 @@ d.cur_frm=f;d.dn=dn;d.table_form=f.meta.istable;f.refresh(dn);$(f.page_layout.wr /* * lib/js/legacy/widgets/form/form_header.js */ -_f.FrmHeader=Class.extend({init:function(parent,frm){this.appframe=new wn.views.AppFrame(parent) +_f.FrmHeader=Class.extend({init:function(parent,frm){this.appframe=new wn.ui.AppFrame(parent) this.appframe.$titlebar.append('\ ');this.$w=this.appframe.$w;},refresh:function(){wn.views.breadcrumbs($(this.$w.find('.breadcrumb-area')),cur_frm.meta.module,cur_frm.meta.name,cur_frm.docname);this.refresh_labels();this.refresh_toolbar();},refresh_labels:function(){var labinfo={0:['Draft',''],1:['Submitted','label-info'],2:['Cancelled','label-important']}[cint(cur_frm.doc.docstatus)];if(cur_frm.doc.__unsaved){labinfo[1]='label-warning'} this.$w.find('.label-area').html(repl('\ @@ -1781,8 +1776,7 @@ this.section_collapse=function(){$(me.row.main_head).find('.head').html(' ' +me.df.label+'');if(no_animation) $(me.row.main_body).toggle(true);else -$(me.row.main_body).slideDown();} -$y(this.row.body,{marginLeft:'17px'});} +$(me.row.main_body).slideDown();}} _f.SectionBreak.prototype.has_data=function(){var me=this;for(var i in me.fields){var f=me.fields[i];var v=f.get_value?f.get_value():null;defaultval=f.df['default']||sys_defaults[f.fieldname]||user_defaults[f.fieldname];if(v&&v!=defaultval){return true;} if(f.df.reqd&&!v){return true;} if(f.df.fieldtype=='Table'){if(f.grid.get_children().length||f.df.reqd){return true;}}} @@ -1891,7 +1885,7 @@ _f.FormGrid.prototype.set_column_label=function(fieldname,label){for(var i=0;i\ \
\ -
\ - \ - Refresh\ - \ - New\ - \ - Filter\ +
\
\
\ More...
\
\
\ - ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){this.make_filters();}},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} -if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();} -if(!me.show_filters){this.$w.find('.btn-filter').remove();} -if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();} -this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') + ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.appframe){this.$w.find('.list-toolbar-wrapper').toggle(false);} +if(this.show_filters){this.make_filters();}},add_button:function(label,click,icon){if(this.appframe){return this.appframe.add_button(label,click,icon)}else{$button=$('').appendTo(this.$w.find('.list-toolbar')) +if(icon){$('').addClass(icon).appendTo($button);} +$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} +if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');} +if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');} +if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') this.onrun=a0;if(a0&&a0.callback) this.onrun=a0.callback;if(!a1&&!(a0&&a0.append)) this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} @@ -191,8 +187,8 @@ if(this.get_args){$.extend(args,this.get_args());} return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}} if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length) -this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.listobj.$w.find('.btn-filter').bind('click',function(){me.$w.find('.show_filters').slideToggle();if(!me.filters.length) -me.add_filter();});this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) +this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length) +this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) values.push(f.get_value());}) return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);}) this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname) @@ -261,7 +257,7 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doct
\
\
\ -
',{label:this.label}));this.appframe=new wn.views.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1 +
',{label:this.label}));this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1 else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);} this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.$page.find('.wnlist-area'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,no_result_message:this.make_no_result(),columns:this.listview.fields});this.run();},make_no_result:function(){return repl('

No %(doctype_label)s found

\ %(description)s\ @@ -269,8 +265,7 @@ this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.wid

\ -

',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('\ - Delete',function(){me.delete_items();},'.btn-filter')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) +

',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;} me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('

Tags

\ @@ -572,6 +567,16 @@ msg_dialog.custom_onhide=callback;} var growl_area;function show_alert(txt,id){if(!growl_area){growl_area=$a(popup_cont,'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});} var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'i','icon-remove-sign',{cssFloat:'right',cursor:'pointer'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);} $(wrapper).hide().fadeIn(1000);} +/* + * lib/js/wn/ui/appframe.js + */ +wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('
').appendTo(parent);this.$titlebar=$('
\ + \ + ×\ +
').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length) +this.$w.append('
');args={label:label,icon:''};if(icon){args.icon='';} +this.buttons[label]=$(repl('',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}}) /* * lib/js/wn/ui/dialog.js */ @@ -589,7 +594,7 @@ wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=fun this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width) this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields) this.make_fields(this.body,this.opts.fields);} -this.make_head=function(){var me=this;this.appframe=new wn.views.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);} +this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);} this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');} this.set_postion=function(){var d=get_screen_dims();this.wrapper.style.left=((d.w-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=(get_scroll_top()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});} this.show=function(){if(this.display)return;this.set_postion() @@ -639,13 +644,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \
\ -
\ - \ - Refresh\ - \ - New\ - \ - Filter\ +
\
\
\ More...
\
\
\ - ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){this.make_filters();}},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} -if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();} -if(!me.show_filters){this.$w.find('.btn-filter').remove();} -if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();} -this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') + ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.appframe){this.$w.find('.list-toolbar-wrapper').toggle(false);} +if(this.show_filters){this.make_filters();}},add_button:function(label,click,icon){if(this.appframe){return this.appframe.add_button(label,click,icon)}else{$button=$('').appendTo(this.$w.find('.list-toolbar')) +if(icon){$('').addClass(icon).appendTo($button);} +$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} +if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');} +if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');} +if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') this.onrun=a0;if(a0&&a0.callback) this.onrun=a0.callback;if(!a1&&!(a0&&a0.append)) this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} @@ -680,8 +681,8 @@ if(this.get_args){$.extend(args,this.get_args());} return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}} if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length) -this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.listobj.$w.find('.btn-filter').bind('click',function(){me.$w.find('.show_filters').slideToggle();if(!me.filters.length) -me.add_filter();});this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) +this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length) +this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) values.push(f.get_value());}) return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);}) this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname) diff --git a/version.num b/version.num index 3641460c4b..6c19a26a54 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1671 \ No newline at end of file +1683