mirror of
https://codeberg.org/artfulrobot/contactcats.git
synced 2025-06-26 01:38:04 +02:00
Fixes and tidies
This commit is contained in:
parent
e56be4ce31
commit
69d4c6b2e8
11 changed files with 191 additions and 40 deletions
|
@ -1,3 +0,0 @@
|
|||
<div af-fieldset="">
|
||||
<crm-search-display-list search-name="Category_for_contact" display-name="Category_for_contact_List_1" filters="{'contact_id': options.contact_id}"></crm-search-display-list>
|
||||
</div>
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"type": "search",
|
||||
"title": "Category",
|
||||
"placement": [
|
||||
"contact_summary_block"
|
||||
],
|
||||
"icon": "fa-list-alt",
|
||||
"server_route": "",
|
||||
"permission": [
|
||||
"access CiviCRM"
|
||||
],
|
||||
"permission_operator": "AND"
|
||||
}
|
3
ang/afsearchContactCategoryCounts.aff.html
Normal file
3
ang/afsearchContactCategoryCounts.aff.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<div af-fieldset="">
|
||||
<crm-search-display-table search-name="SavedSearch_Contact_Category_Counts" display-name="Category_counts"></crm-search-display-table>
|
||||
</div>
|
33
ang/afsearchContactCategoryCounts.aff.json
Normal file
33
ang/afsearchContactCategoryCounts.aff.json
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"type": "search",
|
||||
"title": "Contact Category Counts",
|
||||
"placement": [
|
||||
"dashboard_dashlet"
|
||||
],
|
||||
"icon": "fa-tags",
|
||||
"server_route": "civicrm/reports/contact-category-counts",
|
||||
"permission": [
|
||||
"access CiviCRM"
|
||||
],
|
||||
"permission_operator": "AND",
|
||||
"navigation": {
|
||||
"parent": "Reports",
|
||||
"label": "Contact Category Counts",
|
||||
"weight": 0
|
||||
},
|
||||
"modified_date": "2025-02-27 17:32:42",
|
||||
"requires": null,
|
||||
"entity_type": null,
|
||||
"join_entity": null,
|
||||
"description": 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
|
||||
}
|
|
@ -27,6 +27,10 @@
|
|||
ctrl.categoryToEdit = null;
|
||||
ctrl.categoryDefinitions = null;
|
||||
ctrl.categoryDefinitions = await crmApi4("ContactCategoryDefinition", 'get', { orderBy: { execution_order: 'ASC' }, withLabels: true });
|
||||
if (ctrl.categoryDefinitions.count === 0) {
|
||||
// First time.
|
||||
ctrl.categoryDefinitions = [];
|
||||
}
|
||||
// Ensure we have the minimum of what we need.
|
||||
if (!ctrl.categoryDefinitions.find(c => c.search_type === 'default')) {
|
||||
// There's no default one.
|
||||
|
@ -80,7 +84,7 @@
|
|||
// Create a blank
|
||||
ctrl.categoryToEdit = {
|
||||
id: 0,
|
||||
execution_order: ctrl.categoryDefinitions.length,
|
||||
execution_order: -1,
|
||||
label: '',
|
||||
search_type: 'search',
|
||||
search_data: { saved_search_id: null },
|
||||
|
@ -139,8 +143,14 @@
|
|||
edited.search_data = {saved_search_id};
|
||||
}
|
||||
|
||||
const idx = edited.execution_order;
|
||||
ctrl.categoryDefinitions[idx] = edited;
|
||||
if (edited.execution_order === -1) {
|
||||
// This is a new category, we need to insert it before the default one.
|
||||
const newIdx = ctrl.categoryDefinitions.length - 1;
|
||||
ctrl.categoryDefinitions.splice(newIdx, 0, edited);
|
||||
}
|
||||
else {
|
||||
ctrl.categoryDefinitions[edited.execution_order] = edited;
|
||||
}
|
||||
ctrl.categoryToEdit = null;
|
||||
updateOrders();
|
||||
ctrl.dirty = 'dirty';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue