You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.0 KiB
105 lines
2.0 KiB
class shoppingFunc {
|
|
|
|
getNewItems(args) {
|
|
const {
|
|
dv,
|
|
catItem
|
|
} = args;
|
|
return 0
|
|
}
|
|
getItems2Change(args) {
|
|
const {
|
|
that,
|
|
app,
|
|
dv,
|
|
luxon,
|
|
theme,
|
|
} = args;
|
|
const { metaedit, buttons } = app.plugins.plugins
|
|
const { update } = metaedit.api
|
|
const { createButton } = buttons
|
|
const btnStr = this.getBtnName(theme)
|
|
const updateSct = "Groceries"// await app.obsidian.system.suggester(["groceries", "health", "household"], ["groceries", "health", "household"]); //"Groceries"
|
|
const updateStr = this.getPoint(dv, updateSct)
|
|
|
|
return dv.el('p',
|
|
createButton({
|
|
app,
|
|
el: that.container,
|
|
args: { name: btnStr, color: 'blue' },
|
|
clickOverride: { click: update, params: [updateSct, updateStr, dv.current().file.path]}
|
|
}),
|
|
)
|
|
|
|
}
|
|
|
|
getBtnStrings(dv, oprType) {
|
|
let categItems = ["groceries", "health", "household"];
|
|
let tempRes1 = "Test" //await app.system.suggester(catItems, catItems);
|
|
let tempRes2 = "Test"
|
|
|
|
switch(oprType) {
|
|
case 'to0':
|
|
tempRes2 = "Test"
|
|
break;
|
|
case 'add':
|
|
// const listItems = this.getNewItems(dv, catItem: updateSct);
|
|
tempRes2 = "Test" ////await dv.system.suggester(listItems, listItems);
|
|
break;
|
|
}
|
|
|
|
return tempRes2
|
|
}
|
|
|
|
getBtnName(arg1) {
|
|
let tempresult = "Test";
|
|
switch(arg1) {
|
|
case 'to0':
|
|
tempresult = "Reset shopping list"
|
|
break;
|
|
case 'add':
|
|
tempresult = "Add an item"
|
|
break;
|
|
}
|
|
return tempresult
|
|
}
|
|
|
|
getPoint(p, datapoint) {
|
|
|
|
let result = null
|
|
|
|
switch(datapoint) {
|
|
case 'Groceries':
|
|
result = p.Groceries
|
|
break;
|
|
case 'Health':
|
|
result = p.Health
|
|
break;
|
|
case 'Household':
|
|
result = p.Household
|
|
break;
|
|
case 'type':
|
|
result = p.DocType
|
|
break;
|
|
case 'createddate':
|
|
result = p.Date
|
|
break;
|
|
case 'tag':
|
|
result = p.Tag
|
|
break;
|
|
case 'hierarchy':
|
|
result = p.Hierarchy
|
|
break;
|
|
case 'alias':
|
|
result = p.Alias
|
|
break;
|
|
case 'location':
|
|
result = p.location
|
|
break;
|
|
}
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
} |