[fix] for sort selector

This commit is contained in:
Rushabh Mehta
2016-04-22 13:23:16 +05:30
parent d6bc490274
commit 68d428bfd4
3 changed files with 25 additions and 44 deletions

View File

@@ -196,7 +196,7 @@
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 1,
"collapsible": 0, "collapsible": 0,
"fieldname": "expected_end_date", "fieldname": "expected_end_date",
"fieldtype": "Date", "fieldtype": "Date",
@@ -429,7 +429,7 @@
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 1,
"collapsible": 0, "collapsible": 0,
"fieldname": "percent_complete", "fieldname": "percent_complete",
"fieldtype": "Percent", "fieldtype": "Percent",
@@ -966,14 +966,14 @@
"hide_heading": 0, "hide_heading": 0,
"hide_toolbar": 0, "hide_toolbar": 0,
"icon": "icon-puzzle-piece", "icon": "icon-puzzle-piece",
"idx": 24, "idx": 29,
"in_create": 0, "in_create": 0,
"in_dialog": 0, "in_dialog": 0,
"is_submittable": 0, "is_submittable": 0,
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 4, "max_attachments": 4,
"modified": "2016-03-31 01:34:05.703925", "modified": "2016-04-22 03:15:39.635420",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Projects", "module": "Projects",
"name": "Project", "name": "Project",
@@ -1020,6 +1020,7 @@
"write": 0 "write": 0
} }
], ],
"quick_entry": 1,
"read_only": 0, "read_only": 0,
"read_only_onload": 0, "read_only_onload": 0,
"search_fields": "customer, status, priority, is_active", "search_fields": "customer, status, priority, is_active",

View File

@@ -1,26 +1,7 @@
<div class="padding"> <div class="padding">
<div class="row" style="margin-bottom: 15px;"> <div class="row" style="margin-bottom: 15px;">
<div class="col-sm-8"></div> <div class="col-sm-8"></div>
<div class="col-sm-4"> <div class="col-sm-4 sort-selector-area">
<button class="btn btn-default btn-xs pull-right btn-order"
data-value="desc" style="margin-left: 10px;">
<span class="octicon octicon-triangle-down"></span></button>
<div class="dropdown pull-right" data-value="actual_qty">
<a class="text-muted dropdown-toggle small"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{ __("Actual quantity") }}
</a>
<ul class="dropdown-menu">
<li><a class="option" data-value="actual_qty">
{{ __("Actual quantity") }}</a></li>
<li><a class="option" data-value="reserved_qty">
{{ __("Reserved for sale") }}</a></li>
<li><a class="option" data-value="reserved_qty_for_production">
{{ __("Reserved for manufacturing") }}</a></li>
<li><a class="option" data-value="projected_qty">
{{ __("Projected quantity") }}</a></li>
</ul>
</div>
</div> </div>
</div> </div>
<div class="result list-group"> <div class="result list-group">

View File

@@ -42,26 +42,25 @@ frappe.pages['stock-balance'].on_page_load = function(wrapper) {
refresh(); refresh();
}); });
// order page.sort_selector = new frappe.ui.SortSelector({
page.content.find('.btn-order').on('click', function() { parent: page.content.find('.sort-selector-area'),
var btn = $(this); args: {
var order = $(this).attr('data-value')==='desc' ? 'asc' : 'desc'; sort_by: 'projected_qty',
sort_order: 'asc',
btn.attr('data-value', order); options: [
page.sort_order = order; {fieldname: 'projected_qty', label: __('Projected qty')},
btn.find('.octicon') {fieldname: 'reserved_qty', label: __('Reserved for sale')},
.removeClass('octicon-triangle-' + (order==='asc' ? 'down' : 'up')) {fieldname: 'reserved_qty_for_production', label: __('Reserved for manufacturing')},
.addClass('octicon-triangle-' + (order==='desc' ? 'down' : 'up')); {fieldname: 'actual_qty', label: __('Acutal qty in stock')},
page.start = 0; ]
refresh(); },
}); change: function(sort_by, sort_order) {
page.sort_by = sort_by;
// select field page.sort_order = sort_order;
page.content.find('.dropdown a.option').on('click', function() { page.start = 0;
page.sort_by = $(this).attr('data-value'); refresh();
page.content.find('.dropdown .dropdown-toggle').html($(this).html()); }
refresh(); })
});
var refresh = function() { var refresh = function() {
var item_code = item_field.get_value(); var item_code = item_field.get_value();