From 7d2c0d35a97d4e136799cba19d5da93ff5976fb7 Mon Sep 17 00:00:00 2001 From: Duradundi Date: Tue, 4 Aug 2026 13:48:22 +0530 Subject: [PATCH] Initial commit of Asset custom ui app --- .gitignore | 7 + README.md | 7 + asset_lite_custom_ui/__init__.py | 1 + .../asset_lite_custom_ui/__init__.py | 0 .../asset_lite_custom_ui/page/__init__.py | 0 .../page/modern_menu/__init__.py | 0 .../page/modern_menu/modern_menu.js | 64 ++++ .../page/modern_menu/modern_menu.json | 19 + asset_lite_custom_ui/config/__init__.py | 0 asset_lite_custom_ui/hooks.py | 258 +++++++++++++ asset_lite_custom_ui/modules.txt | 1 + .../overrides/switch_theme.py | 6 + asset_lite_custom_ui/patches.txt | 6 + asset_lite_custom_ui/public/.gitkeep | 0 asset_lite_custom_ui/public/css/menu.css | 52 +++ .../public/css/modern_ui_theme.css | 0 asset_lite_custom_ui/public/css/theme.css | 340 ++++++++++++++++++ asset_lite_custom_ui/public/js/menu/page.js | 112 ++++++ asset_lite_custom_ui/public/js/menu/router.js | 8 + .../public/js/menu/workspace.js | 50 +++ asset_lite_custom_ui/public/js/theme.js | 34 ++ asset_lite_custom_ui/templates/__init__.py | 0 .../templates/pages/__init__.py | 0 license.txt | 21 ++ pyproject.toml | 20 ++ 25 files changed, 1006 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 asset_lite_custom_ui/__init__.py create mode 100644 asset_lite_custom_ui/asset_lite_custom_ui/__init__.py create mode 100644 asset_lite_custom_ui/asset_lite_custom_ui/page/__init__.py create mode 100644 asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/__init__.py create mode 100644 asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/modern_menu.js create mode 100644 asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/modern_menu.json create mode 100644 asset_lite_custom_ui/config/__init__.py create mode 100644 asset_lite_custom_ui/hooks.py create mode 100644 asset_lite_custom_ui/modules.txt create mode 100644 asset_lite_custom_ui/overrides/switch_theme.py create mode 100644 asset_lite_custom_ui/patches.txt create mode 100644 asset_lite_custom_ui/public/.gitkeep create mode 100644 asset_lite_custom_ui/public/css/menu.css create mode 100644 asset_lite_custom_ui/public/css/modern_ui_theme.css create mode 100644 asset_lite_custom_ui/public/css/theme.css create mode 100644 asset_lite_custom_ui/public/js/menu/page.js create mode 100644 asset_lite_custom_ui/public/js/menu/router.js create mode 100644 asset_lite_custom_ui/public/js/menu/workspace.js create mode 100644 asset_lite_custom_ui/public/js/theme.js create mode 100644 asset_lite_custom_ui/templates/__init__.py create mode 100644 asset_lite_custom_ui/templates/pages/__init__.py create mode 100644 license.txt create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba04025 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +*.pyc +*.egg-info +*.swp +tags +node_modules +__pycache__ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..74a5aa4 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +## Asset Lite Custom Ui + +custom app for modifying UI + +#### License + +mit \ No newline at end of file diff --git a/asset_lite_custom_ui/__init__.py b/asset_lite_custom_ui/__init__.py new file mode 100644 index 0000000..f102a9c --- /dev/null +++ b/asset_lite_custom_ui/__init__.py @@ -0,0 +1 @@ +__version__ = "0.0.1" diff --git a/asset_lite_custom_ui/asset_lite_custom_ui/__init__.py b/asset_lite_custom_ui/asset_lite_custom_ui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/asset_lite_custom_ui/asset_lite_custom_ui/page/__init__.py b/asset_lite_custom_ui/asset_lite_custom_ui/page/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/__init__.py b/asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/modern_menu.js b/asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/modern_menu.js new file mode 100644 index 0000000..c88d761 --- /dev/null +++ b/asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/modern_menu.js @@ -0,0 +1,64 @@ +frappe.pages['modern-menu'].on_page_load = function(wrapper) { + var page = frappe.ui.make_app_page({ + parent: wrapper, + title: 'Menu', + single_column: true + }); + frappe.modern_menu.make(page); +} + + +frappe.modern_menu ={ + make(page){ + // Get all items from side menu + let all_pages = frappe.workspaces; + + // Create the HTML + let body = ``; + body +=`
+
+
+
+
+ `; + + + Object.values(all_pages) + .filter((page) => (page.parent_page == "")) + .forEach((item) => { + body += ` + + `; + }) + body +=`
` + + // Append it to the page + $(frappe.render_template(body,this)).appendTo(page.main); + } +} + + +/* + ${ + item.public + ? frappe.utils.icon(item.icon || "folder-normal", "md") + : `` + } + */ \ No newline at end of file diff --git a/asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/modern_menu.json b/asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/modern_menu.json new file mode 100644 index 0000000..2b052fd --- /dev/null +++ b/asset_lite_custom_ui/asset_lite_custom_ui/page/modern_menu/modern_menu.json @@ -0,0 +1,19 @@ +{ + "content": null, + "creation": "2024-09-19 14:15:13.638500", + "docstatus": 0, + "doctype": "Page", + "idx": 0, + "modified": "2024-09-20 15:37:55.472839", + "modified_by": "Administrator", + "module": "Asset Lite Custom Ui", + "name": "modern-menu", + "owner": "Administrator", + "page_name": "modern-menu", + "roles": [], + "script": null, + "standard": "Yes", + "style": null, + "system_page": 0, + "title": "Menu" +} \ No newline at end of file diff --git a/asset_lite_custom_ui/config/__init__.py b/asset_lite_custom_ui/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/asset_lite_custom_ui/hooks.py b/asset_lite_custom_ui/hooks.py new file mode 100644 index 0000000..b8dfe42 --- /dev/null +++ b/asset_lite_custom_ui/hooks.py @@ -0,0 +1,258 @@ +app_name = "asset_lite_custom_ui" +app_title = "Asset Lite Custom Ui" +app_publisher = "SSPL" +app_description = "custom app for modifying UI" +app_email = "sonika123@gmail.com" +app_license = "mit" + +app_include_css = ["/assets/asset_lite_custom_ui/css/theme.css", + "/assets/asset_lite_custom_ui/css/menu.css",] + +app_include_js = ["/assets/asset_lite_custom_ui/js/theme.js", + "/assets/asset_lite_custom_ui/js/menu/router.js", + "/assets/asset_lite_custom_ui/js/menu/page.js", + "/assets/asset_lite_custom_ui/js/menu/workspace.js"] + + + +override_whitelisted_methods = { + "frappe.core.doctype.user.user.switch_theme": "asset_lite_custom_ui.overrides.switch_theme.switch_theme" +} + +# Apps +# ------------------ + +# required_apps = [] + +# Each item in the list will be shown as an app in the apps page +# add_to_apps_screen = [ +# { +# "name": "asset_lite_custom_ui", +# "logo": "/assets/asset_lite_custom_ui/logo.png", +# "title": "Asset Lite Custom Ui", +# "route": "/asset_lite_custom_ui", +# "has_permission": "asset_lite_custom_ui.api.permission.has_app_permission" +# } +# ] + +# Includes in +# ------------------ + +# include js, css files in header of desk.html +# app_include_css = "/assets/asset_lite_custom_ui/css/asset_lite_custom_ui.css" +# app_include_js = "/assets/asset_lite_custom_ui/js/asset_lite_custom_ui.js" + +# include js, css files in header of web template +# web_include_css = "/assets/asset_lite_custom_ui/css/asset_lite_custom_ui.css" +# web_include_js = "/assets/asset_lite_custom_ui/js/asset_lite_custom_ui.js" + +# include custom scss in every website theme (without file extension ".scss") +# website_theme_scss = "asset_lite_custom_ui/public/scss/website" + +# include js, css files in header of web form +# webform_include_js = {"doctype": "public/js/doctype.js"} +# webform_include_css = {"doctype": "public/css/doctype.css"} + +# include js in page +# page_js = {"page" : "public/js/file.js"} + +# include js in doctype views +# doctype_js = {"doctype" : "public/js/doctype.js"} +# doctype_list_js = {"doctype" : "public/js/doctype_list.js"} +# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} +# doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"} + +# Svg Icons +# ------------------ +# include app icons in desk +# app_include_icons = "asset_lite_custom_ui/public/icons.svg" + +# Home Pages +# ---------- + +# application home page (will override Website Settings) +# home_page = "login" + +# website user home page (by Role) +# role_home_page = { +# "Role": "home_page" +# } + +# Generators +# ---------- + +# automatically create page for each record of this doctype +# website_generators = ["Web Page"] + +# Jinja +# ---------- + +# add methods and filters to jinja environment +# jinja = { +# "methods": "asset_lite_custom_ui.utils.jinja_methods", +# "filters": "asset_lite_custom_ui.utils.jinja_filters" +# } + +# Installation +# ------------ + +# before_install = "asset_lite_custom_ui.install.before_install" +# after_install = "asset_lite_custom_ui.install.after_install" + +# Uninstallation +# ------------ + +# before_uninstall = "asset_lite_custom_ui.uninstall.before_uninstall" +# after_uninstall = "asset_lite_custom_ui.uninstall.after_uninstall" + +# Integration Setup +# ------------------ +# To set up dependencies/integrations with other apps +# Name of the app being installed is passed as an argument + +# before_app_install = "asset_lite_custom_ui.utils.before_app_install" +# after_app_install = "asset_lite_custom_ui.utils.after_app_install" + +# Integration Cleanup +# ------------------- +# To clean up dependencies/integrations with other apps +# Name of the app being uninstalled is passed as an argument + +# before_app_uninstall = "asset_lite_custom_ui.utils.before_app_uninstall" +# after_app_uninstall = "asset_lite_custom_ui.utils.after_app_uninstall" + +# Desk Notifications +# ------------------ +# See frappe.core.notifications.get_notification_config + +# notification_config = "asset_lite_custom_ui.notifications.get_notification_config" + +# Permissions +# ----------- +# Permissions evaluated in scripted ways + +# permission_query_conditions = { +# "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions", +# } +# +# has_permission = { +# "Event": "frappe.desk.doctype.event.event.has_permission", +# } + +# DocType Class +# --------------- +# Override standard doctype classes + +# override_doctype_class = { +# "ToDo": "custom_app.overrides.CustomToDo" +# } + +# Document Events +# --------------- +# Hook on document methods and events + +# doc_events = { +# "*": { +# "on_update": "method", +# "on_cancel": "method", +# "on_trash": "method" +# } +# } + +# Scheduled Tasks +# --------------- + +# scheduler_events = { +# "all": [ +# "asset_lite_custom_ui.tasks.all" +# ], +# "daily": [ +# "asset_lite_custom_ui.tasks.daily" +# ], +# "hourly": [ +# "asset_lite_custom_ui.tasks.hourly" +# ], +# "weekly": [ +# "asset_lite_custom_ui.tasks.weekly" +# ], +# "monthly": [ +# "asset_lite_custom_ui.tasks.monthly" +# ], +# } + +# Testing +# ------- + +# before_tests = "asset_lite_custom_ui.install.before_tests" + +# Overriding Methods +# ------------------------------ +# +# override_whitelisted_methods = { +# "frappe.desk.doctype.event.event.get_events": "asset_lite_custom_ui.event.get_events" +# } +# +# each overriding function accepts a `data` argument; +# generated from the base implementation of the doctype dashboard, +# along with any modifications made in other Frappe apps +# override_doctype_dashboards = { +# "Task": "asset_lite_custom_ui.task.get_dashboard_data" +# } + +# exempt linked doctypes from being automatically cancelled +# +# auto_cancel_exempted_doctypes = ["Auto Repeat"] + +# Ignore links to specified DocTypes when deleting documents +# ----------------------------------------------------------- + +# ignore_links_on_delete = ["Communication", "ToDo"] + +# Request Events +# ---------------- +# before_request = ["asset_lite_custom_ui.utils.before_request"] +# after_request = ["asset_lite_custom_ui.utils.after_request"] + +# Job Events +# ---------- +# before_job = ["asset_lite_custom_ui.utils.before_job"] +# after_job = ["asset_lite_custom_ui.utils.after_job"] + +# User Data Protection +# -------------------- + +# user_data_fields = [ +# { +# "doctype": "{doctype_1}", +# "filter_by": "{filter_by}", +# "redact_fields": ["{field_1}", "{field_2}"], +# "partial": 1, +# }, +# { +# "doctype": "{doctype_2}", +# "filter_by": "{filter_by}", +# "partial": 1, +# }, +# { +# "doctype": "{doctype_3}", +# "strict": False, +# }, +# { +# "doctype": "{doctype_4}" +# } +# ] + +# Authentication and authorization +# -------------------------------- + +# auth_hooks = [ +# "asset_lite_custom_ui.auth.validate" +# ] + +# Automatically update python controller files with type annotations for this app. +# export_python_type_annotations = True + +# default_log_clearing_doctypes = { +# "Logging DocType Name": 30 # days to retain logs +# } + diff --git a/asset_lite_custom_ui/modules.txt b/asset_lite_custom_ui/modules.txt new file mode 100644 index 0000000..2f8e42e --- /dev/null +++ b/asset_lite_custom_ui/modules.txt @@ -0,0 +1 @@ +Asset Lite Custom Ui \ No newline at end of file diff --git a/asset_lite_custom_ui/overrides/switch_theme.py b/asset_lite_custom_ui/overrides/switch_theme.py new file mode 100644 index 0000000..be38cb7 --- /dev/null +++ b/asset_lite_custom_ui/overrides/switch_theme.py @@ -0,0 +1,6 @@ +import frappe + +@frappe.whitelist() +def switch_theme(theme): + if theme in ["Dark", "Light", "Automatic", "Modern_ui_theme"]: + frappe.db.set_value("User", frappe.session.user, "desk_theme", theme) \ No newline at end of file diff --git a/asset_lite_custom_ui/patches.txt b/asset_lite_custom_ui/patches.txt new file mode 100644 index 0000000..f15c3a9 --- /dev/null +++ b/asset_lite_custom_ui/patches.txt @@ -0,0 +1,6 @@ +[pre_model_sync] +# Patches added in this section will be executed before doctypes are migrated +# Read docs to understand patches: https://frappeframework.com/docs/v14/user/en/database-migrations + +[post_model_sync] +# Patches added in this section will be executed after doctypes are migrated \ No newline at end of file diff --git a/asset_lite_custom_ui/public/.gitkeep b/asset_lite_custom_ui/public/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/asset_lite_custom_ui/public/css/menu.css b/asset_lite_custom_ui/public/css/menu.css new file mode 100644 index 0000000..56b2ff4 --- /dev/null +++ b/asset_lite_custom_ui/public/css/menu.css @@ -0,0 +1,52 @@ +.no-click{ + cursor:default !important; +} + +.hide-side-section{ + display: none !important; +} + +.widget.menu-widget{ + background-color: #d4daf9; + margin: 20px; +} + +.widget-title .widget-title-text{ + font-weight: 800; + color:white !important; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7); +} + +.menu-widget:hover .widget-title .widget-title-text { + color: var(--gray-100); + text-decoration: none; +} + +.menu-open-btn{ + margin-right: var(--margin-sm); +} + +.widget.menu-widget { + background-size: cover; + background-position: center; + background-repeat: no-repeat; + padding: 20px; + color: white; /* Adjust text color if needed */ +} + +/* Specific background image for each module */ +[data-widget-name="Asset Management"] { + background-image: url('https://i.im.ge/2024/09/19/fG0a6X.businesspeople-working-finance-accounting-analyze-financi.md.jpeg'); +} + +[data-widget-name="CRM"] { + background-image: url('https://i.im.ge/2024/09/19/fGi7UW.customer-relationship-management-concept.md.jpeg'); +} + +[data-widget-name="Buying"] { + background-image: url('https://i.im.ge/2024/09/19/fGhqI6.sumup-dkKsb9eCQS8-unsplash.md.jpeg'); +} + +[data-widget-name="Stock"] { + background-image: url('https://i.im.ge/2024/09/19/fGik1P.Untitled-design.md.png'); +} \ No newline at end of file diff --git a/asset_lite_custom_ui/public/css/modern_ui_theme.css b/asset_lite_custom_ui/public/css/modern_ui_theme.css new file mode 100644 index 0000000..e69de29 diff --git a/asset_lite_custom_ui/public/css/theme.css b/asset_lite_custom_ui/public/css/theme.css new file mode 100644 index 0000000..d736ec7 --- /dev/null +++ b/asset_lite_custom_ui/public/css/theme.css @@ -0,0 +1,340 @@ +/* Works on Chrome, Edge, and Safari */ +/* Taken from https://github.com/tahir-zaqout/sundae_theme/tree/master/sundae_theme/public/css */ +:root{ + --main-color: #271869; + --second-color: #271869; + --third-color: #271869; + --widget-bg: rgb(255, 255, 255) ; +} +[data-theme=modern_ui_theme]{ + --primary: var(--main-color); + --dt-primary-color: var(--main-color); + --blue-avatar-bg: var(--main-color); + --blue-avatar-color: var(--main-color); + --blue: var(--main-color) +} + +[data-theme=modern_ui_theme] .page-container, +[data-theme=modern_ui_theme] .layout-main-section { + background-color: white; +} + +[data-theme=modern_ui_theme] ul li a:hover { + background-color: var(--second-color); + color: #fff; +} +/* Main */ +[data-theme=modern_ui_theme] body { + font-size: 14px; + background-color: #f3f6f9; +} +[data-theme=modern_ui_theme]a { + color: #666; + font-weight: 500; +} +[data-theme=modern_ui_theme] .small, small { + font-size: 95%; +} +[data-theme=modern_ui_theme] .h6.uppercase, h6.uppercase { + font-weight: 600; + font-size: 11.5px; +} + +/* Navigation Bar */ +[data-theme=modern_ui_theme] .standard-sidebar-item.selected{ + background: var(--main-color); +} +[data-theme=modern_ui_theme] .standard-sidebar-item.selected a{ + color: #fff; +} +[data-theme=modern_ui_theme] .standard-sidebar-item.selected a svg{ + fill: #fff; +} +[data-theme=modern_ui_theme] .standard-sidebar-item:hover{ + background-color: var(--second-color); +} +[data-theme=modern_ui_theme] .standard-sidebar-item:hover a, +[data-theme=modern_ui_theme] .standard-sidebar-item:hover svg{ + color: #fff; + fill: #fff; +} + + + +[data-theme=modern_ui_theme] .navbar { + background: var(--main-color); + border: none !important; +} +[data-theme=modern_ui_theme] .navbar-nav>li>a{ + color:#fff !important; +} +[data-theme=modern_ui_theme] .navbar-nav>li>a:hover{ + color:#ddd !important; +} +[data-theme=modern_ui_theme] .navbar-brand:hover { + color:#ddd !important; +} + +/* Widgets */ +[data-theme=modern_ui_theme] .widget { + background-color: var(--widget-bg); + border: none; + box-shadow: 0px 3px 12px 0px var(--widget-bg), 0 3px 3px -2px #461a7714; +} +[data-theme=modern_ui_theme] .widget.shortcut-widget-box .widget-head .widget-title i { + color: var(--third-color); +} +[data-theme=modern_ui_theme] .widget.shortcut-widget-box .widget-head .widget-title:hover span{ + color: var(--main-color); +} +[data-theme=modern_ui_theme] .widget-body .link-item:hover{ + color: #fff; + background: var(--third-color); +} +/* Sidebar */ +[data-theme=modern_ui_theme] .desk-sidebar .desk-sidebar-item { + font-size: 13px; + font-weight: 600; + color: var(--widget-bg); +} +[data-theme=modern_ui_theme] .layout-side-section { + font-size: 14px; +} +[data-theme=modern_ui_theme] .uppercase { + color:var(--third-color); +} + +/* Dropdowns */ +[data-theme=modern_ui_theme] .dropdown-menu>li>a { + font-size: 13px; + color:#666; + font-weight: 500; +} +[data-theme=modern_ui_theme] .awesomplete > ul > li[aria-selected=true]{ + background-color: transparent; +} +[data-theme=modern_ui_theme] .awesomplete > ul > li:hover{ + background: linear-gradient(to right, var(--main-color), var(--second-color)); +} +[data-theme=modern_ui_theme] .awesomplete > ul > li:hover a{ + color: #fff; +} +/* Page Heading */ +[data-theme=modern_ui_theme] .page-head { + border-bottom: none !important; + box-shadow: 0 1px 10px 1px rgba(115, 108, 203, 0.1); +} +[data-theme=modern_ui_theme] .page-title .title-text { + color: var(--third-color); + font-size: 22px; +} +[data-theme=modern_ui_theme] .widget .widget-head .widget-title, +[data-theme=modern_ui_theme] .section-head, +[data-theme=modern_ui_theme] .comment-input-header { + font-size: 14px; + color: var(--third-color); +} + +/*Main Section */ +[data-theme=modern_ui_theme] .list-row-head { + background-color: #f3f6f9; + border-bottom: 1px solid #e4e4e4 !important; +} + +/* Buttons */ +[data-theme=modern_ui_theme] .btn-primary { + background-color: var(--main-color); + border-color: var(--main-color); +} +[data-theme=modern_ui_theme] .control-label, .grid-heading-row { + font-size:13px; +} +[data-theme=modern_ui_theme] .btn-default:hover, +[data-theme=modern_ui_theme] .btn-default:focus, .btn-default.focus, +[data-theme=modern_ui_theme] .btn-default:active, .btn-default.active, +[data-theme=modern_ui_theme] .open > .dropdown-toggle.btn-default { + background-color: var(--third-color) !important; + color: #fff !important; +} +[data-theme=modern_ui_theme] .btn-default:hover svg{ + stroke: #fff !important; + fill: #fff !important; + color: #fff !important; +} +[data-theme=modern_ui_theme] .btn-primary:hover, +[data-theme=modern_ui_theme] .btn-primary:focus, .btn-primary.focus, +[data-theme=modern_ui_theme] .btn-primary:active, .btn-primary.active, +[data-theme=modern_ui_theme] .open > .dropdown-toggle.btn-primary { + background-color: var(--main-color) !important; + border-color: var(--main-color) !important; +} +[data-theme=modern_ui_theme] .btn-secondary, +[data-theme=modern_ui_theme] .btn-secondary:focus, .btn-secondary.focus, +[data-theme=modern_ui_theme] .btn-secondary:active, .btn-secondary.active, +[data-theme=modern_ui_theme] .open > .dropdown-toggle.btn-secondary { + background-color: var(--third-color); + color: #fff; +} + +[data-theme=modern_ui_theme] .btn-secondary:hover{ + background-color: var(--main-color); + color: #fff; +} +[data-theme=modern_ui_theme] .indicator-right.blue:after, .indicator.blue:before { + background: var(--third-color); +} + +/*Other Components*/ +[data-theme=modern_ui_theme] input[type=checkbox]:checked:before { + color: var(--third-color); +} +[data-theme=modern_ui_theme] input[type=checkbox]:checked{ + background: var(--main-color); +} +[data-theme=modern_ui_theme] .frappe-control .ql-editor:not(.read-mode){ + background: var(--widget-bg); +} +[data-theme=modern_ui_theme] .input-with-feedback, +[data-theme=modern_ui_theme] .like-disabled-input{ + background-color: #e8eafcad; +} +[data-theme=modern_ui_theme] .document-link-badge span{ + background-color: var(--main-color) !important; + color: #fff; +} + +[data-theme=modern_ui_theme] .document-link-badge{ + background-color: var(--widget-bg)!important; +} +[data-theme=modern_ui_theme] .document-link button{ + background: var(--third-color) !important; + color: #fff !important; +} + +[data-theme=modern_ui_theme] .document-link button svg{ + fill: white; + stroke: white; +} +[data-theme=modern_ui_theme] .indicator-pill.gray, +[data-theme=modern_ui_theme] .indicator-pill-right.gray, +[data-theme=modern_ui_theme] .indicator-pill-round.gray { + background: var(--third-color); + color: #fff; +} +[data-theme=modern_ui_theme] .indicator-pill.green, +[data-theme=modern_ui_theme] .indicator-pill-right.green, +[data-theme=modern_ui_theme] .indicator-pill-round.green { + color: var(--main-color); +} + +[data-theme=modern_ui_theme] .notifications-icon svg{ + stroke: #fff; + fill: #fff; +} + +[data-theme=modern_ui_theme] #page-Workspaces .page-head{ + background: var(--widget-bg); +} + + +[data-theme=modern_ui_theme] .notifications-unseen use[href="#es-line-notifications-unseen"] { + display: none; + +} + +[data-theme=modern_ui_theme] .notifications-seen use[href="#es-line-notifications"] { + display: none; + +} + +[data-theme=modern_ui_theme] .notifications-unseen { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2264px%22%20height%3D%2264px%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20id%3D%22SVGRepo_bgCarrier%22%20stroke-width%3D%220%22%3E%3C%2Fg%3E%3Cg%20id%3D%22SVGRepo_tracerCarrier%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C%2Fg%3E%3Cg%20id%3D%22SVGRepo_iconCarrier%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M9.29664%204.72727V5.25342C6.60683%206.35644%204.7276%209.97935%204.79579%2013.1192L4.79577%2014.8631C3.4188%2016.6333%203.49982%2019.2727%206.93518%2019.2727H9.29664C9.29664%2019.996%209.57852%2020.6897%2010.0803%2021.2012C10.582%2021.7127%2011.2625%2022%2011.9721%2022C12.6817%2022%2013.3622%2021.7127%2013.8639%2021.2012C14.3656%2020.6897%2014.6475%2019.996%2014.6475%2019.2727H17.0155C20.4443%2019.2727%2020.494%2016.6278%2019.1172%2014.8576L19.1555%2013.1216C19.2248%209.97811%2017.3419%206.35194%2014.6475%205.25049V4.72727C14.6475%204.00395%2014.3656%203.31026%2013.8639%202.7988C13.3622%202.28734%2012.6817%202%2011.9721%202C11.2625%202%2010.582%202.28734%2010.0803%202.7988C9.57852%203.31026%209.29664%204.00395%209.29664%204.72727ZM12.8639%204.72727C12.8639%204.72727%2012.8633%204.76414%2012.8622%204.78246C12.5718%204.74603%2012.2759%204.72727%2011.9757%204.72727C11.673%204.72727%2011.3747%204.74634%2011.082%204.78335C11.0808%204.76474%2011.0803%204.74603%2011.0803%204.72727C11.0803%204.48617%2011.1742%204.25494%2011.3415%204.08445C11.5087%203.91396%2011.7356%203.81818%2011.9721%203.81818C12.2086%203.81818%2012.4354%203.91396%2012.6027%204.08445C12.7699%204.25494%2012.8639%204.48617%2012.8639%204.72727ZM11.0803%2019.2727C11.0803%2019.5138%2011.1742%2019.7451%2011.3415%2019.9156C11.5087%2020.086%2011.7356%2020.1818%2011.9721%2020.1818C12.2086%2020.1818%2012.4354%2020.086%2012.6027%2019.9156C12.7699%2019.7451%2012.8639%2019.5138%2012.8639%2019.2727H11.0803ZM17.0155%2017.4545C17.7774%2017.4545%2018.1884%2016.5435%2017.6926%2015.9538C17.4516%2015.6673%2017.3233%2015.3028%2017.3316%2014.9286L17.3723%2013.0808C17.4404%209.99416%2015.0044%206.54545%2011.9757%206.54545C8.94765%206.54545%206.51196%209.99301%206.57898%2013.0789L6.61916%2014.9289C6.62729%2015.303%206.49893%2015.6674%206.25806%2015.9538C5.76221%2016.5435%206.17325%2017.4545%206.93518%2017.4545H17.0155ZM16.9799%203.20202C17.2945%202.74813%2017.9176%202.63524%2018.3715%202.94988C19.5192%203.74546%2020.8956%205.65348%2021.6471%207.9126C21.8214%208.43664%2021.5379%209.00279%2021.0139%209.17712C20.4898%209.35145%2019.9237%209.06795%2019.7493%208.5439C19.0892%206.55949%2017.9221%205.07189%2017.2321%204.59358C16.7782%204.27894%2016.6653%203.65592%2016.9799%203.20202ZM5.4303%202.94988C5.8842%202.63524%206.50722%202.74813%206.82185%203.20202C7.13649%203.65592%207.0236%204.27894%206.56971%204.59358C5.87969%205.07189%204.71256%206.55949%204.05242%208.5439C3.87809%209.06795%203.31194%209.35145%202.78789%209.17712C2.26384%209.00279%201.98034%208.43664%202.15467%207.9126C2.90619%205.65348%204.2826%203.74546%205.4303%202.94988Z%22%20fill%3D%22%23ffffff%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E"); + background-size: 22px 20px; + background-repeat: no-repeat; + background-position: center; +} + +[data-theme=modern_ui_theme] .notifications-seen { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2264px%22%20height%3D%2264px%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20id%3D%22SVGRepo_bgCarrier%22%20stroke-width%3D%220%22%3E%3C%2Fg%3E%3Cg%20id%3D%22SVGRepo_tracerCarrier%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C%2Fg%3E%3Cg%20id%3D%22SVGRepo_iconCarrier%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M9.33497%204.72727V5.25342C6.64516%206.35644%204.76592%209.97935%204.83412%2013.1192L4.83409%2014.8631C3.45713%2016.6333%203.53815%2019.2727%206.9735%2019.2727H9.33497C9.33497%2019.996%209.61684%2020.6897%2010.1186%2021.2012C10.6203%2021.7127%2011.3008%2022%2012.0104%2022C12.72%2022%2013.4005%2021.7127%2013.9022%2021.2012C14.404%2020.6897%2014.6858%2019.996%2014.6858%2019.2727H17.0538C20.4826%2019.2727%2020.5323%2016.6278%2019.1555%2014.8576L19.1938%2013.1216C19.2631%209.97811%2017.3803%206.35194%2014.6858%205.25049V4.72727C14.6858%204.00396%2014.404%203.31026%2013.9022%202.7988C13.4005%202.28734%2012.72%202%2012.0104%202C11.3008%202%2010.6203%202.28734%2010.1186%202.7988C9.61684%203.31026%209.33497%204.00395%209.33497%204.72727ZM12.9022%204.72727C12.9022%204.74573%2012.9017%204.76414%2012.9006%204.78246C12.6101%204.74603%2012.3142%204.72727%2012.014%204.72727C11.7113%204.72727%2011.413%204.74634%2011.1203%204.78335C11.1192%204.76474%2011.1186%204.74603%2011.1186%204.72727C11.1186%204.48617%2011.2126%204.25494%2011.3798%204.08445C11.547%203.91396%2011.7739%203.81818%2012.0104%203.81818C12.2469%203.81818%2012.4738%203.91396%2012.641%204.08445C12.8083%204.25494%2012.9022%204.48617%2012.9022%204.72727ZM11.1186%2019.2727C11.1186%2019.5138%2011.2126%2019.7451%2011.3798%2019.9156C11.547%2020.086%2011.7739%2020.1818%2012.0104%2020.1818C12.2469%2020.1818%2012.4738%2020.086%2012.641%2019.9156C12.8083%2019.7451%2012.9022%2019.5138%2012.9022%2019.2727H11.1186ZM17.0538%2017.4545C17.8157%2017.4545%2018.2267%2016.5435%2017.7309%2015.9538C17.49%2015.6673%2017.3616%2015.3028%2017.3699%2014.9286L17.4106%2013.0808C17.4787%209.99416%2015.0427%206.54545%2012.014%206.54545C8.98598%206.54545%206.55028%209.99301%206.61731%2013.0789L6.65748%2014.9289C6.66561%2015.303%206.53726%2015.6674%206.29639%2015.9538C5.80054%2016.5435%206.21158%2017.4545%206.9735%2017.4545H17.0538Z%22%20fill%3D%22%23ffffff%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E"); + background-size: 22px 20px; + background-repeat: no-repeat; + background-position: center; +} + +/* [data-theme=modern_ui_theme] .icon use[href="#icon-add"] { + display: none; + +} */ + + +[data-theme=modern_ui_theme] .btn-new .icon, .chart-menu { + /* width: 16px; + height: 16px; + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2240px%22%20height%3D%2240px%22%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22%23000000%22%3E%3Cg%20id%3D%22SVGRepo_bgCarrier%22%20stroke-width%3D%220%22%3E%3C%2Fg%3E%3Cg%20id%3D%22SVGRepo_tracerCarrier%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C%2Fg%3E%3Cg%20id%3D%22SVGRepo_iconCarrier%22%3E%3Ctitle%3E%3C%2Ftitle%3E%3Cg%20id%3D%22Complete%22%3E%3Cg%20data-name%3D%22add%22%20id%3D%22add-2%22%3E%3Cg%3E%3Cline%20fill%3D%22none%22%20stroke%3D%22%23ffffff%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20x1%3D%2212%22%20x2%3D%2212%22%20y1%3D%2219%22%20y2%3D%225%22%2F%3E%3Cline%20fill%3D%22none%22%20stroke%3D%22%23ffffff%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20x1%3D%225%22%20x2%3D%2219%22%20y1%3D%2212%22%20y2%3D%2212%22%2F%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E"); + background-size: 22px 22px; + background-repeat: no-repeat; + background-position: center; */ + --icon-fill: white; + --icon-stroke: white; +} + +[data-theme=modern_ui_theme] .btn-default:hover { + --icon-fill: white; + --icon-stroke: white; +} + +[data-theme=modern_ui_theme] .widget.links-widget-box .link-item .link-content:hover{ + color:white; +} + +[data-theme=modern_ui_theme] .nav-item .nav-link:hover{ + color:white !important + } + + [data-theme=modern_ui_theme] .btn-reset.nav-link span { + color: white; /* Change text color to white on hover */ + transition: color 0.3s ease; /* Optional: Smooth transition */ +} + +[data-theme=modern_ui_theme] .dashboard-graph .widget-group .grid-col-2 { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); + column-gap: 8px; + row-gap: 15px; + align-items: center; +} + +[data-theme=modern_ui_theme] .dashboard-graph .widget-group .grid-col-2 .full-width { + grid-column-start: 1; + grid-column-end: 5; +} + +[data-theme=modern_ui_theme] .dashboard-graph .widget-group { + font-size: 8px; + letter-spacing: 0.01em; +} + +[data-theme=modern_ui_theme] .dashboard-graph .legend-dataset-label { + font-size: 12px; +} + +[data-theme=modern_ui_theme] .dashboard-graph .legend-dataset-value { + font-size: 12px; +} + +/* Target frappe charts but exclude those in full-width widgets */ +[data-theme=modern_ui_theme] .dashboard-graph .dashboard-widget-box:not(.full-width) .frappe-chart.chart { + height: 350px; +} + +/*Profile Icon Colour */ +[data-theme=modern_ui_theme] .avatar-frame.standard-image { + background-color: var(--dark-green-avatar-bg) !important; + color: var(--dark-green-avatar-color) !important; +} + + diff --git a/asset_lite_custom_ui/public/js/menu/page.js b/asset_lite_custom_ui/public/js/menu/page.js new file mode 100644 index 0000000..e8a3878 --- /dev/null +++ b/asset_lite_custom_ui/public/js/menu/page.js @@ -0,0 +1,112 @@ +frappe.templates["page"] = ` +
+
+
+
+ + + + +
+
+
+

+ +
+
+
+ +
+
+
+ + +
+ + + +
+ + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`; + + +frappe.ui.Page = class CustomPage extends frappe.ui.Page { + constructor(opts) { + super(opts); + } + + make() { + // Call parent's make and setup whatever it must + super.make(); + // As an extra add our menu button action + this.setup_menupage_view(); + } + + setup_menupage_view() { + let menupage_view = $(".page-head").find(".menu-open-btn"); + menupage_view.click(() => { + frappe.set_route(['app', 'modern-menu']); + window.location.reload(); + }); + } +} \ No newline at end of file diff --git a/asset_lite_custom_ui/public/js/menu/router.js b/asset_lite_custom_ui/public/js/menu/router.js new file mode 100644 index 0000000..edeeebc --- /dev/null +++ b/asset_lite_custom_ui/public/js/menu/router.js @@ -0,0 +1,8 @@ +frappe.router.render = function () { + if (this.current_route[0]) { + this.render_page(); + } else { + // Show our menu page + frappe.set_route(['app', 'modern-menu']); + } +} \ No newline at end of file diff --git a/asset_lite_custom_ui/public/js/menu/workspace.js b/asset_lite_custom_ui/public/js/menu/workspace.js new file mode 100644 index 0000000..ba4ff34 --- /dev/null +++ b/asset_lite_custom_ui/public/js/menu/workspace.js @@ -0,0 +1,50 @@ +frappe.views.Workspace = class CustomWorkspace extends frappe.views.Workspace { + constructor(wrapper) { + super(wrapper); + } + show() { + // hide side bar for particular view + if (frappe.router?.current_route && + frappe.router.current_route.length > 1 && + frappe.router.current_route[0].toLowerCase() === "workspaces") { + // side bar + let elements = document.querySelectorAll('.layout-side-section'); + elements.forEach(element => { + if (element) element.classList.add('hide-side-section'); + }); + + // Toggle button + let elements2 = document.querySelectorAll('div[data-page-route]:not([data-page-route="menu"]) .sidebar-toggle-btn'); + elements2.forEach(element2 => { + if (element2) element2.classList.add('hide-side-section'); + }); + + // button to navigate to menu + let elements3 = document.querySelectorAll('div[data-page-route]:not([data-page-route="menu"]) .menu-open-btn'); + elements3.forEach(element3 => { + if (element3) element3.classList.remove('hide-side-section'); + }); + } else { + // side bar + let elements = document.querySelectorAll('.layout-side-section'); + elements.forEach(element => { + if (element) element.classList.remove('hide-side-section'); + }); + + // Toggle button + let elements2 = document.querySelectorAll('div[data-page-route]:not([data-page-route="menu"]) .sidebar-toggle-btn'); + elements2.forEach(element2 => { + if (element2) element2.classList.remove('hide-side-section'); + }); + + // button to navigate to menu + let elements3 = document.querySelectorAll('div[data-page-route]:not([data-page-route="menu"]) .menu-open-btn'); + elements3.forEach(element3 => { + if (element3) element3.classList.add('hide-side-section'); + }); + } + + // call the parent's show + super.show(); + } +} \ No newline at end of file diff --git a/asset_lite_custom_ui/public/js/theme.js b/asset_lite_custom_ui/public/js/theme.js new file mode 100644 index 0000000..fee490d --- /dev/null +++ b/asset_lite_custom_ui/public/js/theme.js @@ -0,0 +1,34 @@ +frappe.ui.ThemeSwitcher = class CustomThemeSwitcher extends frappe.ui.ThemeSwitcher { + constructor() { + super() + } + + fetch_themes() { + return new Promise((resolve) => { + this.themes = [ + { + name: "light", + label: ("Frappe Light"), + info: ("Light Theme"), + }, + { + name: "dark", + label: "Timeless Night", + info: "Dark Theme", + }, + { + name: "modern_ui_theme", + label: "Modern Desk UI", + info: "The theme I copied from github" + }, + { + name: "automatic", + label: "Automatic", + info: "Uses system's theme to switch between light and dark mode", + } + ]; + + resolve(this.themes); + }); + } +} \ No newline at end of file diff --git a/asset_lite_custom_ui/templates/__init__.py b/asset_lite_custom_ui/templates/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/asset_lite_custom_ui/templates/pages/__init__.py b/asset_lite_custom_ui/templates/pages/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..8aa2645 --- /dev/null +++ b/license.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..493e71e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,20 @@ +[project] +name = "asset_lite_custom_ui" +authors = [ + { name = "SSPL", email = "sonika123@gmail.com"} +] +description = "custom app for modifying UI" +requires-python = ">=3.10" +readme = "README.md" +dynamic = ["version"] +dependencies = [ + # "frappe~=15.0.0" # Installed and managed by bench. +] + +[build-system] +requires = ["flit_core >=3.4,<4"] +build-backend = "flit_core.buildapi" + +# These dependencies are only installed when developer mode is enabled +[tool.bench.dev-dependencies] +# package_name = "~=1.1.0"