added basic exporting

This commit is contained in:
vabene1111 2020-09-22 00:32:42 +02:00
parent 70df7c5307
commit 5e2dba7b04

View File

@ -196,6 +196,31 @@
</table> </table>
</div> </div>
</div> </div>
<b-button class="btn btn-success" v-b-modal.id_modal_export>{% trans 'Export' %}</b-button>
<b-modal id="id_modal_export" title="{% trans 'Copy/Export' %}">
<div class="row">
<div class="col col-12">
<label>
{% trans 'List Prefix' %}
<input class="form-control" v-model="export_text_prefix">
</label>
</div>
</div>
<div class="row">
<div class="col col-12">
<b-form-textarea class="form-control" max-rows="8" v-model="export_text">
</b-form-textarea>
</div>
</div>
</b-modal>
</div> </div>
@ -220,6 +245,7 @@
shopping_list_id: {% if shopping_list_id %}{{ shopping_list_id }}{% else %}null{% endif %}, shopping_list_id: {% if shopping_list_id %}{{ shopping_list_id }}{% else %}null{% endif %},
loading: true, loading: true,
edit_mode: false, edit_mode: false,
export_text_prefix: '', //TODO add userpreference
recipe_query: '', recipe_query: '',
recipes: [], recipes: [],
shopping_list: undefined, shopping_list: undefined,
@ -264,6 +290,13 @@
return entries return entries
}, },
export_text() {
let text = ''
for (let e of this.display_entries) {
text += `${this.export_text_prefix}${e.amount} ${e.unit.name} ${e.food.name} \n`
}
return text
},
}, },
/* /*
watch: { watch: {