[hub] form (info) view for items
This commit is contained in:
parent
9b64620bc0
commit
b8e9c9be08
@ -15,7 +15,7 @@ def enable_hub():
|
||||
return hub_settings
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_items(start=0, limit=20, category=None, order_by=None, company=None, text=None):
|
||||
def get_items(start=0, limit=20, fields=["*"], category=None, order_by=None, company=None, text=None):
|
||||
connection = get_client_connection()
|
||||
|
||||
filters = {}
|
||||
@ -29,9 +29,23 @@ def get_items(start=0, limit=20, category=None, order_by=None, company=None, tex
|
||||
|
||||
response = connection.get_list('Hub Item',
|
||||
limit_start=start, limit_page_length=limit,
|
||||
filters=filters)
|
||||
filters=filters, fields=fields)
|
||||
return response
|
||||
|
||||
#
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_hub_item_meta():
|
||||
connection = get_client_connection()
|
||||
meta = connection.get_doc('DocType', 'Hub Item')
|
||||
return meta
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_hub_company_meta():
|
||||
connection = get_client_connection()
|
||||
meta = connection.get_doc('DocType', 'Hub Company')
|
||||
return meta
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_categories():
|
||||
connection = get_client_connection()
|
||||
@ -43,7 +57,10 @@ def get_item_details(hub_sync_id=None):
|
||||
if not hub_sync_id:
|
||||
return
|
||||
connection = get_client_connection()
|
||||
return connection.get_doc('Hub Item', hub_sync_id)
|
||||
item_details = connection.get_doc('Hub Item', hub_sync_id)
|
||||
print("============details=============")
|
||||
print(item_details)
|
||||
return item_details
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_company_details(hub_sync_id):
|
||||
|
@ -1,8 +0,0 @@
|
||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Hub Category', {
|
||||
refresh: function(frm) {
|
||||
|
||||
}
|
||||
});
|
@ -1,275 +0,0 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "field:hub_category_name",
|
||||
"beta": 0,
|
||||
"creation": "2017-08-22 11:31:10.410322",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "hub_category_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Category Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "parent_hub_category",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Parent Category",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Hub Category",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "is_group",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text Editor",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Description",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Left",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "rgt",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Right",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Old Parent",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-09-03 22:04:22.958831",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Hub Node",
|
||||
"name": "Hub Category",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "hub_category_name",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils.nestedset import NestedSet
|
||||
from frappe.model.document import Document
|
||||
|
||||
class HubCategory(NestedSet):
|
||||
pass
|
@ -1,4 +0,0 @@
|
||||
frappe.treeview_settings["Hub Category"] = {
|
||||
title: __("Hub Category"),
|
||||
breadcrumb: "Hub"
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/* eslint-disable */
|
||||
// rename this file from _test_[name] to test_[name] to activate
|
||||
// and remove above this line
|
||||
|
||||
QUnit.test("test: Hub Category", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Hub Category
|
||||
() => frappe.tests.make('Hub Category', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
@ -1,10 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
class TestHubCategory(unittest.TestCase):
|
||||
pass
|
@ -9,7 +9,7 @@ frappe.pages['hub'].on_page_load = function(wrapper) {
|
||||
single_col: false
|
||||
});
|
||||
|
||||
wrapper.hub_page = new erpnext.hub.Hub({ page });
|
||||
// wrapper.hub_page = new erpnext.hub.Hub({ page });
|
||||
};
|
||||
|
||||
frappe.pages['hub'].on_page_show = function(wrapper) {
|
||||
@ -776,7 +776,7 @@ erpnext.hub.HubList = class HubList {
|
||||
limit: this.page_length + 1
|
||||
};
|
||||
Object.assign(args, this.filters);
|
||||
console.log("filters: ", args);
|
||||
// console.log("filters: ", args);
|
||||
args.order_by = this.order_by;
|
||||
args.by_item_codes = this.by_item_codes;
|
||||
|
||||
@ -785,7 +785,7 @@ erpnext.hub.HubList = class HubList {
|
||||
args: args,
|
||||
callback: (r) => {
|
||||
let items = r.message;
|
||||
console.log("items: ", items);
|
||||
// console.log("items: ", items);
|
||||
this.render_items(items);
|
||||
}
|
||||
});
|
||||
@ -796,7 +796,6 @@ erpnext.hub.HubList = class HubList {
|
||||
// clear any filler divs
|
||||
this.$list.find('.filler').remove();
|
||||
let done = 0;
|
||||
console.log("items length", items.length);
|
||||
if(items.length && items.length > this.page_length) {
|
||||
// remove the extra queried
|
||||
items.pop();
|
||||
|
@ -1,3 +1,29 @@
|
||||
body[data-route^="Hub/"] .freeze .image-view-container .list-row-col {
|
||||
background-color: #fafbfc;
|
||||
color: #fafbfc;
|
||||
}
|
||||
body[data-route^="Hub/"] .freeze .image-view-container .placeholder-text {
|
||||
color: #fafbfc;
|
||||
}
|
||||
body[data-route^="Hub/"] .freeze {
|
||||
display: none;
|
||||
}
|
||||
body[data-route^="Hub/"] .image-view-container {
|
||||
justify-content: space-around;
|
||||
}
|
||||
.img-wrapper {
|
||||
border: 1px solid #d1d8dd;
|
||||
border-radius: 3px;
|
||||
padding: 12px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.img-wrapper .helper {
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
/* hub */
|
||||
div[data-page-route="hub"] .page-head {
|
||||
height: 80px;
|
||||
|
@ -169,8 +169,5 @@ input[type=number]::-webkit-outer-spin-button {
|
||||
height: 60px;
|
||||
}
|
||||
.grand-total .grand-total-value {
|
||||
font-size: 18px;
|
||||
}
|
||||
.rounded-total-value {
|
||||
font-size: 18px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
@ -5,9 +5,22 @@ frappe.views.HubFactory = frappe.views.Factory.extend({
|
||||
const page_name = frappe.get_route_str();
|
||||
const page = route[1];
|
||||
|
||||
const assets = {
|
||||
'List': [
|
||||
'/assets/erpnext/js/hub/hub_page.js',
|
||||
'/assets/erpnext/css/hub.css',
|
||||
],
|
||||
'Form': [
|
||||
'/assets/erpnext/js/hub/hub_form.js',
|
||||
'/assets/erpnext/css/hub.css',
|
||||
]
|
||||
};
|
||||
console.log("make factory?");
|
||||
|
||||
if (!erpnext.hub.pages[page_name]) {
|
||||
console.log("pages?");
|
||||
if (page === 'Item' && !route[2]) {
|
||||
frappe.require('/assets/erpnext/js/hub/hub_page.js', () => {
|
||||
frappe.require(assets['List'], () => {
|
||||
erpnext.hub.pages[page_name] = new erpnext.hub.HubPage({
|
||||
doctype: 'Hub Settings',
|
||||
parent: this.make_page(true, page_name)
|
||||
@ -15,7 +28,8 @@ frappe.views.HubFactory = frappe.views.Factory.extend({
|
||||
window.hub_page = erpnext.hub.pages[page_name];
|
||||
});
|
||||
} else if(route[2]) {
|
||||
frappe.require('/assets/erpnext/js/hub/hub_form.js', () => {
|
||||
console.log("form?");
|
||||
frappe.require(assets['Form'], () => {
|
||||
erpnext.hub.pages[page_name] = new erpnext.hub.HubForm({
|
||||
hub_item_code: route[2],
|
||||
doctype: 'Hub Settings',
|
||||
@ -25,6 +39,7 @@ frappe.views.HubFactory = frappe.views.Factory.extend({
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log("else?");
|
||||
frappe.container.change_to(page_name);
|
||||
window.hub_page = erpnext.hub.pages[page_name];
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ erpnext.hub.HubForm = class HubForm extends frappe.views.BaseList {
|
||||
}
|
||||
|
||||
setup_fields() {
|
||||
|
||||
this.fields = ['hub_item_code', 'item_name', 'item_code', 'description', 'seller', 'company_name', 'country'];
|
||||
}
|
||||
|
||||
set_breadcrumbs() {
|
||||
@ -40,9 +40,12 @@ erpnext.hub.HubForm = class HubForm extends frappe.views.BaseList {
|
||||
};
|
||||
}
|
||||
|
||||
prepare_data(r) {
|
||||
this.data = r.message;
|
||||
}
|
||||
|
||||
update_data(r) {
|
||||
const data = r.message;
|
||||
this.data = data;
|
||||
this.data = r.message;
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -51,13 +54,14 @@ erpnext.hub.HubForm = class HubForm extends frappe.views.BaseList {
|
||||
});
|
||||
|
||||
let fields = [];
|
||||
for (let fieldname in this.data) {
|
||||
this.fields.map(fieldname => {
|
||||
fields.push({
|
||||
label: toTitle(fieldname),
|
||||
label: toTitle(frappe.model.unscrub(fieldname)),
|
||||
fieldname,
|
||||
fieldtype: 'Data'
|
||||
fieldtype: 'Data',
|
||||
read_only: 1
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.form = new frappe.ui.FieldGroup({
|
||||
parent: this.$result,
|
||||
|
@ -8,10 +8,22 @@ erpnext.hub.HubPage = class HubPage extends frappe.views.BaseList {
|
||||
|
||||
const route = frappe.get_route();
|
||||
this.page_name = route[1];
|
||||
|
||||
return this.get_hub_item_meta()
|
||||
.then(r => {
|
||||
this.meta = r.message || this.meta;
|
||||
this.doctype = 'Hub Item';
|
||||
frappe.model.sync(this.meta);
|
||||
});
|
||||
}
|
||||
|
||||
get_hub_item_meta() {
|
||||
return new Promise(resolve =>
|
||||
frappe.call('erpnext.hub_node.get_hub_item_meta', {}, resolve));
|
||||
}
|
||||
|
||||
setup_fields() {
|
||||
|
||||
this.fields = ['name', 'hub_item_code', 'image', 'item_name', 'item_code'];
|
||||
}
|
||||
|
||||
set_breadcrumbs() {
|
||||
@ -23,13 +35,32 @@ erpnext.hub.HubPage = class HubPage extends frappe.views.BaseList {
|
||||
}
|
||||
|
||||
setup_filter_area() {
|
||||
|
||||
this.custom_filter_configs = [
|
||||
{
|
||||
fieldtype: 'Data',
|
||||
label: 'Company',
|
||||
condition: 'like',
|
||||
fieldname: 'company_name',
|
||||
},
|
||||
{
|
||||
fieldtype: 'Link',
|
||||
label: 'Country',
|
||||
options: 'Country',
|
||||
condition: 'like',
|
||||
fieldname: 'country'
|
||||
}
|
||||
];
|
||||
this.filter_area = new FilterArea(this);
|
||||
}
|
||||
|
||||
setup_sort_selector() {
|
||||
|
||||
}
|
||||
|
||||
setup_view() {
|
||||
|
||||
}
|
||||
|
||||
get_args() {
|
||||
return {
|
||||
start: this.start,
|
||||
@ -37,18 +68,33 @@ erpnext.hub.HubPage = class HubPage extends frappe.views.BaseList {
|
||||
category: this.category || '',
|
||||
order_by: this.order_by,
|
||||
company: this.company || '',
|
||||
text: this.search_text || ''
|
||||
text: this.search_text || '',
|
||||
fields: this.fields
|
||||
};
|
||||
}
|
||||
|
||||
update_data(r) {
|
||||
const data = r.message;
|
||||
console.log('update data', data);
|
||||
|
||||
if (this.start === 0) {
|
||||
this.data = data;
|
||||
} else {
|
||||
this.data = this.data.concat(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
freeze(toggle) {
|
||||
this.$freeze.toggle(toggle);
|
||||
if (this.$freeze.find('.image-view-container').length) return;
|
||||
|
||||
const html = Array.from(new Array(4)).map(d => this.card_html({
|
||||
name: 'freeze',
|
||||
item_name: 'freeze'
|
||||
})).join('');
|
||||
|
||||
this.$freeze.html(`<div class="image-view-container border-top">${html}</div>`);
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -56,13 +102,15 @@ erpnext.hub.HubPage = class HubPage extends frappe.views.BaseList {
|
||||
}
|
||||
|
||||
render_image_view() {
|
||||
var html = this.data.map(this.card_html.bind(this)).join("");
|
||||
let data = this.data;
|
||||
console.log('this.data render', this.data);
|
||||
if (this.start === 0) {
|
||||
this.$result.html('<div class="image-view-container small padding-top">');
|
||||
data = this.data.slice(this.start);
|
||||
}
|
||||
|
||||
this.$result.html(`
|
||||
<div class="image-view-container small">
|
||||
${html}
|
||||
</div>
|
||||
`);
|
||||
var html = data.map(this.card_html.bind(this)).join("");
|
||||
this.$result.find('.image-view-container').append(html);
|
||||
}
|
||||
|
||||
card_html(item) {
|
||||
@ -70,39 +118,28 @@ erpnext.hub.HubPage = class HubPage extends frappe.views.BaseList {
|
||||
const encoded_name = item._name;
|
||||
const title = strip_html(item['item_name' || 'item_code']);
|
||||
|
||||
const _class = !item.image ? 'no-image' : '';
|
||||
const _html = item.image ?
|
||||
`<img data-name="${encoded_name}" src="${ item.image }" alt="${ title }">` :
|
||||
`<span class="placeholder-text">
|
||||
${ frappe.get_abbr(title) }
|
||||
</span>`;
|
||||
const route = `#Hub/Item/${item.hub_item_code}`;
|
||||
|
||||
const image_html = item.image ?
|
||||
`<img src="${item.image}">
|
||||
<span class="helper"></span>` :
|
||||
`<div class="standard-image">${frappe.get_abbr(title)}</div>`;
|
||||
|
||||
return `
|
||||
<div class="image-view-item">
|
||||
<div class="image-view-header">
|
||||
<div class="list-row-col list-subject ellipsis level">
|
||||
<div class="list-row-col">
|
||||
<span>${title}</span>
|
||||
<div class="hub-item-wrapper margin-bottom" style="width: 200px;">
|
||||
<a href="${route}">
|
||||
<div class="hub-item-image">
|
||||
<div class="img-wrapper" style="height: 200px; width: 200px">
|
||||
${image_html}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="image-view-body">
|
||||
<a data-name="${encoded_name}"
|
||||
title="${encoded_name}"
|
||||
href="#Hub/Item/${item.hub_item_code}"
|
||||
>
|
||||
<div class="image-field ${_class}"
|
||||
data-name="${encoded_name}"
|
||||
>
|
||||
${_html}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="hub-item-title">
|
||||
<h5 class="bold">
|
||||
${ title }
|
||||
</h5>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
show_hub_form() {
|
||||
|
||||
}
|
||||
};
|
||||
};
|
@ -1,5 +1,41 @@
|
||||
@import "../../../../frappe/frappe/public/less/variables.less";
|
||||
|
||||
body[data-route^="Hub/"] {
|
||||
.freeze .image-view-container {
|
||||
.list-row-col {
|
||||
background-color: @light-bg;
|
||||
color: @light-bg;
|
||||
}
|
||||
|
||||
.placeholder-text {
|
||||
color: @light-bg;
|
||||
}
|
||||
}
|
||||
|
||||
.freeze {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.image-view-container {
|
||||
justify-content: space-around;
|
||||
}
|
||||
}
|
||||
|
||||
.img-wrapper {
|
||||
border: 1px solid #d1d8dd;
|
||||
border-radius: 3px;
|
||||
padding: 12px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
|
||||
.helper {
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
/* hub */
|
||||
div[data-page-route="hub"] {
|
||||
.page-head {
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user