From ededbe832595d067621fe39edffcae133a66b5e3 Mon Sep 17 00:00:00 2001 From: mic Date: Mon, 13 May 2024 20:29:11 +0200 Subject: [PATCH] many improvments related to #12. still work in progress --- customprompts/mzta-custom-prompts.js | 124 +++++++++++++++++++++------ 1 file changed, 96 insertions(+), 28 deletions(-) diff --git a/customprompts/mzta-custom-prompts.js b/customprompts/mzta-custom-prompts.js index 19b0f144..29e49576 100644 --- a/customprompts/mzta-custom-prompts.js +++ b/customprompts/mzta-custom-prompts.js @@ -27,46 +27,47 @@ var idnumMax = 0; document.addEventListener('DOMContentLoaded', async () => { let options = { valueNames: [ { data: ['idnum'] }, 'is_default', 'id', 'name', 'text', 'type', 'action', 'position_compose', 'position_display', { name: 'need_selected', attr: 'checked_val'}, { name: 'need_signature', attr: 'checked_val'}, { name: 'need_custom_text', attr: 'checked_val'}, { name: 'enabled', attr: 'checked_val'} ], - item: function(values) { //TODO: manage ACTION and TYPE edit with the select + item: function(values) { //TODO: manage ACTION edit with the select let type_output = ''; - switch(values.type){ - case 0: + switch(String(values.type)){ + case "0": type_output = `__MSG_customPrompts_add_to_menu_always__`; break; - case 1: + case "1": type_output = `__MSG_customPrompts_add_to_menu_reading__`; break; - case 2: + case "2": type_output = `__MSG_customPrompts_add_to_menu_composing__`; break; } let action_output = ''; - switch(values.action){ - case 0: + switch(String(values.action)){ + case "0": action_output = `__MSG_customPrompts_close_button__`; break; - case 1: + case "1": action_output = `__MSG_customPrompts_save_button__`; break; - case 2: + case "2": action_output = `__MSG_customPrompts_do_reply__`; break; } + //console.log('>>>>>>>>>>>>> action_output: ' + JSON.stringify(action_output)); let output = ` - - - + + + ` + ((values.is_default == 1) ? type_output : - ` `) + ` - + Action: ` + ((values.is_default == 1) ? action_output : `