#command-center
^buttons
^9308f3
try {
const {CommandCenter} = customJS
const this2 = this
CommandCenter.generate_view({this2,dv})
} catch {
dv.span("We are working hard to prepare your buttons for you β³")
}
^59a0d4
class CommandCenter { | |
async create_finance(args) { | |
const { this2 } = args | |
let newEntry = "Financial Stuff/Spending/Record/Untitiled.md" | |
newEntry = await app.vault.create(newEntry, '') | |
app.workspace.getLeaf(false).openFile(newEntry) | |
} | |
async create_goals(args) { | |
const { this2 } = args | |
let newEntry = "Financial Stuff/Spending/Goals/Untitiled.md" | |
newEntry = await app.vault.create(newEntry, '') | |
app.workspace.getLeaf(false).openFile(newEntry) | |
} | |
async create_data_rec(args) { | |
const { this2 } = args | |
let newEntry = "data/Record/Untitiled.md" | |
newEntry = await app.vault.create(newEntry, '') | |
app.workspace.getLeaf(false).openFile(newEntry) | |
} | |
async create_domain_credit(args) { | |
const { this2 } = args | |
let newEntry = "Financial Stuff/Domain Stuff/Credit/Untitiled.md" | |
newEntry = await app.vault.create(newEntry, '') | |
app.workspace.getLeaf(false).openFile(newEntry) | |
} | |
async open_finance_calc(args) { | |
const { this2 } = args | |
const file = await app.plugins.getPlugin('templater-obsidian').templater.functions_generator.internal_functions.modules_array.find(x => x.name === "file").static_object | |
const existing = file.find_tfile("Financial Stuff/Spending/Calculated") | |
app.workspace.getLeaf(false).openFile(existing) | |
} | |
async open_credit_calc(args) { | |
const { this2 } = args | |
const file = await app.plugins.getPlugin('templater-obsidian').templater.functions_generator.internal_functions.modules_array.find(x => x.name === "file").static_object | |
const existing = file.find_tfile("Financial Stuff/Domain Stuff/Calculated") | |
app.workspace.getLeaf(false).openFile(existing) | |
} | |
async open_data_calc(args) { | |
const { this2 } = args | |
const file = await app.plugins.getPlugin('templater-obsidian').templater.functions_generator.internal_functions.modules_array.find(x => x.name === "file").static_object | |
const existing = file.find_tfile("data/Calculate") | |
app.workspace.getLeaf(false).openFile(existing) | |
} | |
async generate_view(args){ | |
const { this2,dv } = args | |
const { createButton } = this2.app.plugins.plugins["buttons"]; | |
const {CommandCenter} = customJS | |
createButton({ | |
app, | |
el: this2.container, | |
args: { name: "π΅ Open finance entry", id: "button-create-open-finance"}, | |
clickOverride: { click: CommandCenter.create_finance, params: [this2] }, | |
}); | |
dv.span(" ") | |
createButton({ | |
app, | |
el: this2.container, | |
args: { name: "π΅ See calculated finance", id: "button-open-finance-calc"}, | |
clickOverride: { click: CommandCenter.open_finance_calc, params: [this2] }, | |
}); | |
dv.span("<br></br>") | |
createButton({ | |
app, | |
el: this2.container, | |
args: { name: "π Create a new goal", id: "button-create-goals"}, | |
clickOverride: { click: CommandCenter.create_goals, params: [this2] }, | |
}); | |
dv.span("<br></br>") | |
createButton({ | |
app, | |
el: this2.container, | |
args: { name: "π³ Add new domain credit", id: "button-create-domain-credit"}, | |
clickOverride: { click: CommandCenter.create_domain_credit, params: [this2] }, | |
}); | |
dv.span(" ") | |
createButton({ | |
app, | |
el: this2.container, | |
args: { name: "π³ See calculated domain credit", id: "button-open-domain-credit-calc"}, | |
clickOverride: { click: CommandCenter.open_credit_calc, params: [this2] }, | |
}); | |
dv.span("<br></br>") | |
createButton({ | |
app, | |
el: this2.container, | |
args: { name: "π Open data record", id: "button-create-data-rec"}, | |
clickOverride: { click: CommandCenter.create_data_rec, params: [this2] }, | |
}); | |
createButton({ | |
app, | |
el: this2.container, | |
args: { name: "π See calculated mobile data usage", id: "button-open-data-calc"}, | |
clickOverride: { click: CommandCenter.open_data_calc, params: [this2] }, | |
}); | |
dv.span("<br></br>") | |
} | |
} |