Skip to content

Commit

Permalink
feat: add Settings doctype (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
umer2001 authored Nov 19, 2024
1 parent e25ff3e commit 8264334
Show file tree
Hide file tree
Showing 17 changed files with 269 additions and 0 deletions.
Empty file.
25 changes: 25 additions & 0 deletions frappe/core/doctype/settings/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt

frappe.ui.form.on("Settings", {
refresh: function (frm) {
const link = $("div[data-fieldname='business_details'] > a");
link.attr("href", `/app/company/${frappe.user_defaults.company}`);

// check if webshop is installed, only then show the webshop settings
if (!Object.keys(this.installed_apps ?? {}).length) {
this.installed_apps = {};
frappe.call({
method: "frappe.utils.change_log.get_versions",
callback: (r) => {
this.installed_apps = r.message;
frm.toggle_display(['website_setting'], this.installed_apps.hasOwnProperty('webshop'));
},
});
}

// set team link
const team_link = $("div[data-fieldname='the_team'] > a");
team_link.attr("href", `https://${frappe.get_cookie(`login_source-${window.location.hostname}`) || "dashboard.zaviago.com"}/dashboard/app?modal=team`);
},
});
123 changes: 123 additions & 0 deletions frappe/core/doctype/settings/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-07-09 11:21:31.006092",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"general_setting_section",
"business_details",
"shipping_n_delivery",
"taxes",
"column_break_vtal",
"invoice_n_documents",
"currencies",
"personal_information",
"online_store_setting_section",
"website_setting",
"payments",
"column_break_tkje",
"online_store_regions",
"team_permission_section",
"the_team"
],
"fields": [
{
"description": "Manage the settings of your business at zaviago",
"fieldname": "general_setting_section",
"fieldtype": "Section Break",
"label": "General Settings"
},
{
"fieldname": "business_details",
"fieldtype": "HTML",
"options": "<a href=\"/app/company/Default%20Company\" class=\"settings-page-card\">\n <div class=\"card-left\">\n <span class=\"settings-page-card-icon\">\n <img src=\"/assets/frappe/images/bdetailicon.svg\">\n </span>\n <div class=\"card-detail\">\n <span>Business Details</span>\n <span class=\"card-desc\">Manage your business Detail</span>\n </div>\n \n </div>\n <div class=\"card-right\">\n <span class=\"settings-page-card-icon-right\">\n <img src=\"/assets/frappe/images/chevron-right.svg\">\n </span>\n </div>\n</a>"
},
{
"fieldname": "shipping_n_delivery",
"fieldtype": "HTML",
"options": "<a href=\"/app/shipping-rule\" class=\"settings-page-card\">\n <div class=\"card-left\">\n <span class=\"settings-page-card-icon\">\n <img src=\"/assets/frappe/images/shipndel.svg\">\n </span>\n <div class=\"card-detail\">\n <span>Shipping &amp; Delivery</span>\n <span class=\"card-desc\">Choose where you ship and how much you charge for it</span>\n </div>\n </div>\n <div class=\"card-right\">\n <span class=\"settings-page-card-icon-right\">\n <img src=\"/assets/frappe/images/chevron-right.svg\">\n </span>\n </div>\n</a>"
},
{
"fieldname": "taxes",
"fieldtype": "HTML",
"options": "<a href=\"/app/sales-taxes-and-charges-template\" class=\"settings-page-card\">\n <div class=\"card-left\">\n <span class=\"settings-page-card-icon\">\n <img src=\"/assets/frappe/images/taxesico.svg\">\n </span>\n <div class=\"card-detail\">\n <span>Taxes</span>\n <span class=\"card-desc\">Manage how taxes are calculated and shown in your store</span>\n </div>\n </div>\n <div class=\"card-right\">\n <span class=\"settings-page-card-icon-right\">\n <img src=\"/assets/frappe/images/chevron-right.svg\">\n </span>\n </div>\n</a>"
},
{
"fieldname": "column_break_vtal",
"fieldtype": "Column Break"
},
{
"fieldname": "invoice_n_documents",
"fieldtype": "HTML",
"options": "<a href=\"\" class=\"settings-page-card\">\n <div class=\"card-left\">\n <span class=\"settings-page-card-icon\">\n <img src=\"/assets/frappe/images/invoic-ndocs.svg\">\n </span>\n <div class=\"card-detail\">\n <span>Invoice &amp; Documents <img src=\"/assets/frappe/images/coming-sson.svg\"></span>\n <span class=\"card-desc\">Customize your invoices </span>\n </div>\n </div>\n <div class=\"card-right\">\n <span class=\"settings-page-card-icon-right\">\n <img src=\"/assets/frappe/images/chevron-right.svg\">\n </span>\n </div>\n</a>"
},
{
"fieldname": "currencies",
"fieldtype": "HTML",
"options": "<a href=\"\" class=\"settings-page-card\">\n <div class=\"card-left\">\n <span class=\"settings-page-card-icon\">\n <img src=\"/assets/frappe/images/curr-ico.svg\">\n </span>\n <div class=\"card-detail\">\n <span>Currencies <img src=\"/assets/frappe/images/coming-sson.svg\"></span>\n <span class=\"card-desc\">Manage the currencies that will be available in your store</span>\n </div>\n </div>\n <div class=\"card-right\">\n <span class=\"settings-page-card-icon-right\">\n <img src=\"/assets/frappe/images/chevron-right.svg\">\n </span>\n </div>\n</a>"
},
{
"fieldname": "personal_information",
"fieldtype": "HTML",
"options": "<a href=\"\" class=\"settings-page-card\">\n <div class=\"card-left\">\n <span class=\"settings-page-card-icon\">\n <img src=\"/assets/frappe/images/pers-info.svg\">\n </span>\n <div class=\"card-detail\">\n <span>Personal Information <img src=\"/assets/frappe/images/coming-sson.svg\"></span>\n <span class=\"card-desc\">Manage your own personal workspace profile</span>\n </div>\n </div>\n <div class=\"card-right\">\n <span class=\"settings-page-card-icon-right\">\n <img src=\"/assets/frappe/images/chevron-right.svg\">\n </span>\n </div>\n</a>"
},
{
"fieldname": "online_store_setting_section",
"fieldtype": "Section Break",
"label": "Online Store Settings"
},
{
"fieldname": "website_setting",
"fieldtype": "HTML",
"options": "<a data-dependsonapp=\"webshop\" href=\"/app/webshop-settings/\" class=\"settings-page-card\">\n <div class=\"card-left\">\n <span class=\"settings-page-card-icon\">\n <img src=\"/assets/frappe/images/web-set-ic.svg\">\n </span>\n <div class=\"card-detail\">\n <span>Website Settings</span>\n <span class=\"card-desc\">Manage general settings for your online store</span>\n </div>\n </div>\n <div class=\"card-right\">\n <span class=\"settings-page-card-icon-right\">\n <img src=\"/assets/frappe/images/chevron-right.svg\">\n </span>\n </div>\n</a>"
},
{
"fieldname": "payments",
"fieldtype": "HTML",
"options": "<a href=\"/app/webshop-settings/#tabpayment\" class=\"settings-page-card\">\n <div class=\"card-left\">\n <span class=\"settings-page-card-icon\">\n <img src=\"/assets/frappe/images/bdetailicon.svg\">\n </span>\n <div class=\"card-detail\">\n <span>Payments</span>\n <span class=\"card-desc\">Manage your payment setting at checkout or payment links</span>\n </div>\n </div>\n <div class=\"card-right\">\n <span class=\"settings-page-card-icon-right\">\n <img src=\"/assets/frappe/images/chevron-right.svg\">\n </span>\n </div>\n</a>"
},
{
"fieldname": "column_break_tkje",
"fieldtype": "Column Break"
},
{
"fieldname": "online_store_regions",
"fieldtype": "HTML",
"options": "<a href=\"\" class=\"settings-page-card\">\n <div class=\"card-left\">\n <span class=\"settings-page-card-icon\">\n <img src=\"/assets/frappe/images/mstoreregi.svg\">\n </span>\n <div class=\"card-detail\">\n <span>Online Store Regions <img src=\"/assets/frappe/images/coming-sson.svg\"></span>\n <span class=\"card-desc\">Manage the markets that you will operate within</span>\n </div>\n </div>\n <div class=\"card-right\">\n <span class=\"settings-page-card-icon-right\">\n <img src=\"/assets/frappe/images/chevron-right.svg\">\n </span>\n </div>\n</a>"
},
{
"fieldname": "team_permission_section",
"fieldtype": "Section Break",
"label": "Team Permission <img src=\"/assets/frappe/images/sup-admin-ico.svg\">"
},
{
"fieldname": "the_team",
"fieldtype": "HTML",
"options": "<a href=\"\" class=\"settings-page-card\">\n <div class=\"card-left\">\n <span class=\"settings-page-card-icon\">\n <img src=\"/assets/frappe/images/team-ico.svg\">\n </span>\n <div class=\"card-detail\">\n <span>The Team</span>\n <span class=\"card-desc\">Manage users of your Workspace</span>\n </div>\n </div>\n <div class=\"card-right\">\n <span class=\"settings-page-card-icon-right\">\n <img src=\"/assets/frappe/images/chevron-right.svg\">\n </span>\n </div>\n</a>"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-11-18 16:03:57.053243",
"modified_by": "Administrator",
"module": "Core",
"name": "Settings",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"print": 1,
"read": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
19 changes: 19 additions & 0 deletions frappe/core/doctype/settings/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2024, Frappe Technologies and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class Settings(Document):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from frappe.types import DF


# end: auto-generated types
pass
9 changes: 9 additions & 0 deletions frappe/core/doctype/settings/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024, Frappe Technologies and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestSettings(FrappeTestCase):
pass
8 changes: 8 additions & 0 deletions frappe/public/images/bdetailicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions frappe/public/images/chevron-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8264334

Please sign in to comment.