mirror of
https://codeberg.org/artfulrobot/contactcats.git
synced 2025-06-27 00:47:17 +02:00
Fix contact summary search display
This commit is contained in:
parent
e65d0dcf6c
commit
ac8d415729
4 changed files with 45 additions and 78 deletions
|
@ -18,10 +18,8 @@
|
|||
totalCount: '=?'
|
||||
},
|
||||
controller: function($scope, $element, crmApi4, searchDisplayBaseTrait, searchDisplayTasksTrait) {
|
||||
console.log('crmSearchDisplayContactCat controller called');
|
||||
// Mix in required traits
|
||||
ctrl = angular.extend(this, _.cloneDeep(searchDisplayBaseTrait), _.cloneDeep(searchDisplayTasksTrait));
|
||||
console.log("hello display");
|
||||
var ts = ($scope.ts = CRM.ts(null)),
|
||||
ctrl = this;
|
||||
|
||||
|
@ -40,7 +38,7 @@
|
|||
|
||||
$scope.$watch('$ctrl.results', () => { ctrl.n++; }, true);
|
||||
$scope.$watch('$ctrl.n', () => {
|
||||
console.log("watch n running");
|
||||
console.log("watch n running 2025-04-02 ");
|
||||
if (!ctrl.catDefs || !ctrl.results?.count) {
|
||||
console.log("...waiting for all the data we need");
|
||||
ctrl.ourData = {
|
||||
|
@ -50,17 +48,25 @@
|
|||
return ctrl.n;
|
||||
}
|
||||
|
||||
// Should do this at the php end but I don't know how.
|
||||
ctrl.results.sort((a, b) => {
|
||||
if (a.data.activity_date_time < b.data.activity_date_time) return 1;
|
||||
if (a.data.activity_date_time > b.data.activity_date_time) return -1;
|
||||
return a.data.id - b.data.id;
|
||||
});
|
||||
const rows = ctrl.results.map((row) => {
|
||||
const d = (new Date(row.data.activity_date_time.replace(' ', 'T'))).toLocaleString('UTC', {
|
||||
weekday: 'short',
|
||||
day: 'numeric',
|
||||
month: 'short',
|
||||
year: 'numeric',
|
||||
});
|
||||
const d = (new Date(row.data.activity_date_time.replace(' ', 'T'))),
|
||||
when = d.toLocaleString('UTC', {
|
||||
weekday: 'short',
|
||||
day: 'numeric',
|
||||
month: 'short',
|
||||
year: 'numeric',
|
||||
});
|
||||
return {
|
||||
contact_id: row.data['Activity_ActivityContact_Contact_01.id'],
|
||||
new: ctrl.catDefs[row.data['Category_changes.new_category_id']],
|
||||
when: d,
|
||||
when,
|
||||
data: row.data,
|
||||
};
|
||||
});
|
||||
ctrl.ourData = {rows, count:rows.length};
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
<!-- output the current category -->
|
||||
<details class="">
|
||||
<summary>
|
||||
{{ts('Category')}}:
|
||||
{{ts('Category')}}:
|
||||
<span ng-if="!$ctrl.ourData.count" >{{ts('Loading')}}</span>
|
||||
<span ng-if="$ctrl.ourData.count" style="color:{{$ctrl.ourData.rows[0].new.color}};">
|
||||
<i class="crm-i {{$ctrl.ourData.rows[0].new.icon}}" ></i>
|
||||
<i class="crm-i {{$ctrl.ourData.rows[0].new.icon}}" ></i>
|
||||
{{$ctrl.ourData.rows[0].new.label}}
|
||||
</span>
|
||||
</summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue