Add redundant contact_id field for search kit/form builder; add index on category field...

This commit is contained in:
Rich Lott / Artful Robot 2024-02-28 17:18:46 +00:00
parent 9fee48603b
commit 7b611c343f
7 changed files with 113 additions and 29 deletions

View file

@ -1,18 +1,22 @@
/* Add any CSS rules for Angular module "crmContactcats" */
crm-contact-category-settings ol {
padding:0;
padding: 0;
}
crm-contact-category-settings ol li {
display: flex;
padding:0.5em 0;
padding: 0.5em 0;
align-items: flex-end;
gap: 1em;
}
crm-contact-category-settings li label {
display: block;
}
crm-contact-category-settings .name-input-wrapper {
flex: 0 1 29ch;
}
crm-contact-category-settings .hint {
display:none;
display: none;
}
crm-contact-category-settings .name-input-wrapper:focus-within .hint {
display:block;
display: block;
}

View file

@ -2,34 +2,57 @@
Loading...
</div>
<form ng-if="$ctrl.catmap" crm-ui-id-scope>
<button ng-click="$ctrl.catmap.unshift({groupID: '', name:''})"><i class="crm-i fa-plus"></i> Add category</button>
<button ng-click="$ctrl.catmap.unshift({groupID: '', name:''})">
<i class="crm-i fa-plus"></i> Add category
</button>
<ol class="crm-catmap">
<li ng-repeat="(idx, row) in $ctrl.catmap">
<select ng-if="row.groupID === '' || row.groupID > 0"
crm-ui-select="{placeholder:'Select group',allowClear:false}" ng-model="$ctrl.catmap[idx].groupID"
style="width: 18rem">
<option ng-repeat="(grpIdx, grp) in $ctrl.getGroupsFor(idx)" value="{{grp.id}}">{{grp.title}}</option>
</select>
<div ng-if="row.groupID !== '' && row.groupID == 0" style="width: 18rem;display: inline-block;">
<div class="group-input-wrapper">
<label crm-ui-for="group{{idx}}">Group</label>
<select
crm-ui-id="group{{idx}}"
ng-if="row.groupID === '' || row.groupID > 0"
crm-ui-select="{placeholder:'Select group',allowClear:false}"
ng-model="$ctrl.catmap[idx].groupID"
style="width: 18rem"
>
<option
ng-repeat="(grpIdx, grp) in $ctrl.getGroupsFor(idx)"
value="{{grp.id}}"
>{{grp.title}}</option
>
</select>
</div>
<div
ng-if="row.groupID !== '' && row.groupID == 0"
style="width: 18rem;display: inline-block;"
>
Default
</div>
<div class=name-input-wrapper>
<div class="name-input-wrapper">
<label crm-ui-for="name{{idx}}">Label</label>
<input crm-ui-id="name{{idx}}" type=text ng-model="$ctrl.catmap[idx].name"
ng-keydown="$ctrl.nameKeydown($event, idx)" />
<input
crm-ui-id="name{{idx}}"
type="text"
ng-model="$ctrl.catmap[idx].name"
ng-keydown="$ctrl.nameKeydown($event, idx)"
/>
<div class="hint description">
{{ts('Use the Up/Down arrow keys to re-order')}}
</div>
</div>
<div>
<button ng-click="$ctrl.deleteRow(idx)"><i class="fa-trash crm-i"></i> Delete</button>
<button ng-click="$ctrl.deleteRow(idx)">
<i class="fa-trash crm-i"></i> Delete
</button>
</div>
</li>
</ol>
<p>
<button ng-click="$ctrl.save()"><i class="crm-i fa-save"></i> Save</button>
</p>
<div ng-if="$ctrl.saved" class="help">Categories saved. Contacts will be updated shortly (when the next Scheduled
Job run
happens).</div>
<div ng-if="$ctrl.saved" class="help">
Categories saved. Contacts will be updated shortly (when the next Scheduled
Job run happens).
</div>
</form>