Add support for "configured customer/member key"

also improve product key support, same patterns
This commit is contained in:
Lance Edgar 2023-06-06 11:06:16 -05:00
parent 9b59b44609
commit 0d97ff2936
7 changed files with 224 additions and 39 deletions

View file

@ -6,6 +6,26 @@
<h3 class="block is-size-3">General</h3>
<div class="block" style="padding-left: 2rem;">
<b-field grouped>
<b-field label="Key Field">
<b-select name="rattail.customers.key_field"
v-model="simpleSettings['rattail.customers.key_field']"
@input="updateKeyLabel()">
<option value="id">id</option>
<option value="number">number</option>
</b-select>
</b-field>
<b-field label="Key Field Label">
<b-input name="rattail.customers.key_label"
v-model="simpleSettings['rattail.customers.key_label']"
@input="settingsNeedSaved = true">
</b-input>
</b-field>
</b-field>
<b-field message="If not set, customer chooser is an autocomplete field.">
<b-checkbox name="rattail.customers.choice_uses_dropdown"
v-model="simpleSettings['rattail.customers.choice_uses_dropdown']"
@ -33,5 +53,29 @@
</%def>
<%def name="modify_this_page_vars()">
${parent.modify_this_page_vars()}
<script type="text/javascript">
ThisPage.methods.getLabelForKey = function(key) {
switch (key) {
case 'id':
return "ID"
case 'number':
return "Number"
default:
return "Key"
}
}
ThisPage.methods.updateKeyLabel = function() {
this.simpleSettings['rattail.customers.key_label'] = this.getLabelForKey(
this.simpleSettings['rattail.customers.key_field'])
this.settingsNeedSaved = true
}
</script>
</%def>
${parent.body()}