mirror of
https://codeberg.org/artfulrobot/contactcats.git
synced 2025-06-26 05:48:05 +02:00
SK/FB work
This commit is contained in:
parent
16f2b6235d
commit
a4c9251f5e
10 changed files with 163 additions and 233 deletions
|
@ -1,5 +1,7 @@
|
|||
<div af-fieldset="" af-title="Contacts by Category">
|
||||
<af-field name="Contact_ContactCategory_contact_id_01.category" defn="{input_attrs: {multiple: true}}" />
|
||||
<af-field name="contact_sub_type" defn="{input_attrs: {multiple: true}}" />
|
||||
<div af-fieldset="">
|
||||
<div class="af-container af-layout-inline af-container-style-pane" af-title="Filters">
|
||||
<af-field name="Contact_ContactCategory_contact_id_01.category_definition_id" defn="{search_operator: 'IN', input_attrs: {autoOpen: true, multiple: true}, security: 'FBAC', label: 'Category'}" />
|
||||
<af-field name="display_name" defn="{search_operator: 'CONTAINS', input_attrs: {}, label: 'Name'}" />
|
||||
</div>
|
||||
<crm-search-display-table search-name="Contacts_by_category" display-name="Contacts_by_category_Table_1"></crm-search-display-table>
|
||||
</div>
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
{
|
||||
"type": "search",
|
||||
"requires": null,
|
||||
"entity_type": null,
|
||||
"join_entity": null,
|
||||
"title": "Contacts by category",
|
||||
"description": "Individuals only",
|
||||
"placement": [],
|
||||
"summary_contact_type": null,
|
||||
"summary_weight": null,
|
||||
"icon": "fa-tags",
|
||||
"server_route": "civicrm/contact/search/category",
|
||||
"is_public": false,
|
||||
"permission": [
|
||||
"access CiviCRM"
|
||||
],
|
||||
"permission_operator": "AND",
|
||||
"redirect": null,
|
||||
"submit_enabled": true,
|
||||
"submit_limit": null,
|
||||
"create_submission": false,
|
||||
"manual_processing": false,
|
||||
"allow_verification_by_email": false,
|
||||
"email_confirmation_template_id": null,
|
||||
"navigation": {
|
||||
"parent": "Search",
|
||||
"label": "Contacts by category",
|
||||
"weight": 0
|
||||
},
|
||||
"modified_date": "2024-02-28 16:59:26",
|
||||
"requires": null,
|
||||
"entity_type": null,
|
||||
"join_entity": null,
|
||||
"summary_contact_type": null,
|
||||
"summary_weight": null,
|
||||
"is_public": false,
|
||||
"redirect": null,
|
||||
"submit_enabled": true,
|
||||
"submit_limit": null,
|
||||
"create_submission": null,
|
||||
"manual_processing": null,
|
||||
"allow_verification_by_email": null,
|
||||
"email_confirmation_template_id": null
|
||||
"modified_date": "2025-02-25 14:51:17"
|
||||
}
|
||||
|
|
|
@ -26,7 +26,21 @@
|
|||
ctrl.moveIdx = null;
|
||||
ctrl.categoryToEdit = null;
|
||||
ctrl.categoryDefinitions = null;
|
||||
ctrl.categoryDefinitions = await crmApi4("ContactCategoryDefinition", 'get', { orderBy: { label: 'ASC' }, withLabels: true });
|
||||
ctrl.categoryDefinitions = await crmApi4("ContactCategoryDefinition", 'get', { orderBy: { execution_order: 'ASC' }, withLabels: true });
|
||||
// Ensure we have the minimum of what we need.
|
||||
if (!ctrl.categoryDefinitions.find(c => c.search_type === 'default')) {
|
||||
// There's no default one.
|
||||
ctrl.categoryDefinitions.push({
|
||||
id: 0,
|
||||
execution_order: ctrl.categoryDefinitions.length,
|
||||
label: '9999 ' + ts('Other'),
|
||||
search_type: 'default',
|
||||
search_data: {},
|
||||
color: '#666666',
|
||||
icon: 'fa-person-circle-question',
|
||||
description: ts('Any contact not matching any of the categories is assigned this category.'),
|
||||
})
|
||||
}
|
||||
updateOrders();
|
||||
console.log("Got", ctrl.categoryDefinitions);
|
||||
|
||||
|
@ -89,7 +103,7 @@
|
|||
ctrl.categoryDefinitions.splice(idx, 0, item);
|
||||
ctrl.moveIdx = null;
|
||||
updateOrders();
|
||||
$ctrl.dirty = 'dirty';
|
||||
ctrl.dirty = 'dirty';
|
||||
};
|
||||
|
||||
ctrl.deleteCategory = idx => {
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<button ng-if="$ctrl.moveIdx === null && row.deleted" ng-click="row.deleted = false;$ctrl.dirty = 'dirty';">
|
||||
<i class="fa-trash crm-i"></i> {{ts('Un-Delete')}}
|
||||
</button>
|
||||
<button ng-if="$ctrl.moveIdx === null && !row.deleted" ng-click="$ctrl.moveIdx = idx"
|
||||
<button ng-if="$ctrl.moveIdx === null && !row.deleted && row.search_type !== 'default'" ng-click="$ctrl.moveIdx = idx"
|
||||
class="btn"
|
||||
ng-disabled="$ctrl.categoryDefinitions.length === 1"
|
||||
>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<i class="fa-circle-xmark crm-i"></i> {{ts('Cancel Move')}}
|
||||
</button>
|
||||
<button ng-click="$ctrl.moveTo(idx+1)" ng-show="$ctrl.moveIdx !== null && (idx === 0 && $ctrl.moveIdx > 0)" ><i class="fa-sort-up crm-i" ></i>{{ts('Before this')}}</button>
|
||||
<button ng-click="$ctrl.moveTo(idx+1)" ng-show="$ctrl.moveIdx !== null && (idx + 1 < $ctrl.moveIdx || idx > $ctrl.moveIdx)"><i class="fa-sort-down crm-i" ></i>{{ts('After this')}}</button>
|
||||
<button ng-click="$ctrl.moveTo(idx+1)" ng-show="$ctrl.moveIdx !== null && row.search_type !== 'default' && (idx + 1 < $ctrl.moveIdx || idx > $ctrl.moveIdx)"><i class="fa-sort-down crm-i" ></i>{{ts('After this')}}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -102,66 +102,66 @@
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div crm-ui-field="{name: 'cc.color', title: ts('Color')}" >
|
||||
<input
|
||||
crm-ui-id="ci.color"
|
||||
name="color"
|
||||
type="color"
|
||||
ng-model="$ctrl.categoryToEdit.color"
|
||||
class="crm-form-color"
|
||||
/>
|
||||
</div>
|
||||
<div crm-ui-field="{name: 'cc.color', title: ts('Color')}" >
|
||||
<input
|
||||
crm-ui-id="ci.color"
|
||||
name="color"
|
||||
type="color"
|
||||
ng-model="$ctrl.categoryToEdit.color"
|
||||
class="crm-form-color"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div crm-ui-field="{name: 'cc.icon', title: ts('Icon')}" >
|
||||
<input
|
||||
crm-ui-id="cc.icon"
|
||||
crm-ui-icon-picker
|
||||
ng-model="$ctrl.categoryToEdit.icon"
|
||||
/>
|
||||
</div>
|
||||
<div crm-ui-field="{name: 'cc.icon', title: ts('Icon')}" >
|
||||
<!-- this seems buggy, doesn't update to show the icon given. -->
|
||||
<input
|
||||
crm-ui-id="cc.icon"
|
||||
crm-ui-icon-picker
|
||||
ng-model="$ctrl.categoryToEdit.icon"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div crm-ui-field="{name: 'cc.description', title: ts('Description')}" >
|
||||
<input
|
||||
crm-ui-id="ci.description"
|
||||
name="description"
|
||||
ng-model="$ctrl.categoryToEdit.description"
|
||||
class="crm-form-textarea"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
<div crm-ui-field="{name: 'cc.description', title: ts('Description')}" >
|
||||
<input
|
||||
crm-ui-id="ci.description"
|
||||
name="description"
|
||||
ng-model="$ctrl.categoryToEdit.description"
|
||||
class="crm-form-textarea"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div crm-ui-field="{name: 'cc.search_type', title: ts('How are contacts identified?')}" >
|
||||
<select
|
||||
crm-ui-id="ci.search_type"
|
||||
name="search_type"
|
||||
ng-model="$ctrl.categoryToEdit.search_type"
|
||||
ng-change="$ctrl.fixSearchData()"
|
||||
>
|
||||
<option value="search" >{{ts('Search Kit search')}}</option>
|
||||
<option value="group" >{{ts('Group')}}</option>
|
||||
<!-- future? <option value="sql_template" >{{ts('SQL template')}}</option> -->
|
||||
</select>
|
||||
</div>
|
||||
<div ng-if="cc.search_type !== 'default'" crm-ui-field="{name: 'cc.search_type', title: ts('How are contacts identified?')}" >
|
||||
<select
|
||||
crm-ui-id="ci.search_type"
|
||||
name="search_type"
|
||||
ng-model="$ctrl.categoryToEdit.search_type"
|
||||
ng-change="$ctrl.fixSearchData()"
|
||||
>
|
||||
<option value="search" >{{ts('Search Kit search')}}</option>
|
||||
<option value="group" >{{ts('Group')}}</option>
|
||||
<!-- future? <option value="sql_template" >{{ts('SQL template')}}</option> -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- fields for search kit -->
|
||||
<div ng-if="$ctrl.categoryToEdit.search_type === 'search'" crm-ui-field="{name:'cc.saved_search_id', title: ts('Search Kit search')}" >
|
||||
<input crm-ui-id='cc.saved_search_id' crm-entityref="{entity: 'SavedSearch', select: {allowClear:false}}"
|
||||
ng-model="$ctrl.categoryToEdit.search_data.saved_search_id" />
|
||||
</div>
|
||||
<!-- fields for search kit -->
|
||||
<div ng-if="$ctrl.categoryToEdit.search_type === 'search'" crm-ui-field="{name:'cc.saved_search_id', title: ts('Search Kit search')}" >
|
||||
<input crm-ui-id='cc.saved_search_id' crm-entityref="{entity: 'SavedSearch', select: {allowClear:false}}"
|
||||
ng-model="$ctrl.categoryToEdit.search_data.saved_search_id" />
|
||||
</div>
|
||||
|
||||
<!-- fields for groups -->
|
||||
<div ng-if="$ctrl.categoryToEdit.search_type === 'group'" crm-ui-field="{name:'cc.group_id', title: ts('Group')}" >
|
||||
<input crm-ui-id='cc.group_id' crm-entityref="{entity: 'Group', select: {allowClear:false}}"
|
||||
ng-model="$ctrl.categoryToEdit.search_data.group_id" />
|
||||
</div>
|
||||
<!-- fields for groups -->
|
||||
<div ng-if="$ctrl.categoryToEdit.search_type === 'group'" crm-ui-field="{name:'cc.group_id', title: ts('Group')}" >
|
||||
<input crm-ui-id='cc.group_id' crm-entityref="{entity: 'Group', select: {allowClear:false}}"
|
||||
ng-model="$ctrl.categoryToEdit.search_data.group_id" />
|
||||
</div>
|
||||
|
||||
|
||||
<!-- type=button means when you hit Enter in an input above this button is skipped while it looks for the first submit button. -->
|
||||
<button type=button ng-click="$ctrl.view = 'list'"
|
||||
class="btn btn-secondary"
|
||||
>Cancel</button>
|
||||
<button ng-click="$ctrl.updateEditedThing()" >Done</button>
|
||||
|
||||
<!-- type=button means when you hit Enter in an input above this button is skipped while it looks for the first submit button. -->
|
||||
<button type=button ng-click="$ctrl.view = 'list'"
|
||||
class="btn btn-secondary"
|
||||
>Cancel</button>
|
||||
<button ng-click="$ctrl.updateEditedThing()" >Done</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue