added ability to order property types

This commit is contained in:
vabene1111
2023-08-24 12:50:17 +02:00
parent 17fa3c8d7c
commit 92d648c3a3
7 changed files with 49 additions and 7 deletions

View File

@ -131,6 +131,7 @@ export default {
'property_amount_total': rp.property_amount * this.recipe.servings * (this.servings / this.recipe.servings),
'missing_value': false,
'unit': rp.property_type.unit,
'type': rp.property_type,
}
)
})
@ -147,11 +148,23 @@ export default {
'property_amount_total': fp.total_value * (this.servings / this.recipe.servings),
'missing_value': fp.missing_value,
'unit': fp.unit,
'type': fp,
}
)
}
}
return pt_list
function compare(a,b){
if(a.type.order > b.type.order){
return 1
}
if(a.type.order < b.type.order){
return -1
}
return 0
}
return pt_list.sort(compare)
}
},
mounted() {

View File

@ -319,6 +319,7 @@
"CategoryName": "Category Name",
"SupermarketName": "Supermarket Name",
"CategoryInstruction": "Drag categories to change the order categories appear in shopping list.",
"OrderInformation": "Objects are ordered from small to large numbers.",
"shopping_recent_days_desc": "Days of recent shopping list entries to display.",
"shopping_recent_days": "Recent Days",
"download_pdf": "Download PDF",

View File

@ -281,7 +281,7 @@ export class Models {
apiName: "Unit",
paginated: true,
create: {
params: [["name", "plural_name", "description", "base_unit","open_data_slug",]],
params: [["name", "plural_name", "description", "base_unit", "open_data_slug",]],
form: {
show_help: true,
name: {
@ -711,7 +711,7 @@ export class Models {
},
},
create: {
params: [['name', 'icon', 'unit', 'description']],
params: [['name', 'icon', 'unit', 'description','order']],
form: {
show_help: true,
name: {
@ -745,6 +745,15 @@ export class Models {
placeholder: "",
optional: true,
},
order: {
form_field: true,
type: "number",
field: "order",
label: "Order",
placeholder: "",
optional: true,
helpt_text: "OrderInformation",
},
open_data_slug: {
form_field: true,
type: "text",