Working time calendar default field, users, teams panels

This commit is contained in:
Yurii
2026-06-04 11:39:47 +03:00
parent ccdd5fcbfb
commit 9f2edd9d00
8 changed files with 105 additions and 3 deletions

View File

@@ -0,0 +1,53 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
namespace Espo\Classes\FieldProcessing\WorkingTimeCalendar;
use Espo\Core\FieldProcessing\Loader;
use Espo\Core\FieldProcessing\Loader\Params;
use Espo\Core\Utils\Config;
use Espo\Entities\WorkingTimeCalendar;
use Espo\ORM\Entity;
/**
* @implements Loader<WorkingTimeCalendar>
*/
class IsDefaultLoader implements Loader
{
public function __construct(
private Config $config,
) {}
public function process(Entity $entity, Params $params): void
{
$isDefault = $entity->getId() === $this->config->get('workingTimeCalendarId');
$entity->set('isDefault', $isDefault);
}
}

View File

@@ -18,9 +18,14 @@
"weekday3TimeRanges": "Wed Schedule",
"weekday4TimeRanges": "Thu Schedule",
"weekday5TimeRanges": "Fri Schedule",
"weekday6TimeRanges": "Sat Schedule"
"weekday6TimeRanges": "Sat Schedule",
"isDefault": "Is Default"
},
"links": {
"users": "Users",
"ranges": "Exceptions"
},
"tooltips": {
"isDefault": "Indicates whether this calendar is the system default. The default working time calendar can be configured in: Administration > Settings > Working Time Calendar."
}
}

View File

@@ -2,5 +2,9 @@
{
"name": "name",
"link": true
},
{
"name": "isDefault",
"width": 14
}
]

View File

@@ -1,3 +1,5 @@
[
"ranges"
"ranges",
"users",
"teams"
]

View File

@@ -15,5 +15,17 @@
}
]
}
},
"relationshipPanels": {
"teams": {
"createDisabled": true,
"editDisabled": true,
"removeDisabled": true
},
"users": {
"createDisabled": true,
"editDisabled": true,
"removeDisabled": true
}
}
}

View File

@@ -83,6 +83,14 @@
"default": null,
"view": "views/working-time-calendar/fields/time-ranges"
},
"isDefault": {
"type": "bool",
"readOnly": true,
"notStorable": true,
"orderDisabled": true,
"loaderClassName": "Espo\\Classes\\FieldProcessing\\WorkingTimeCalendar\\IsDefaultLoader",
"tooltip": true
},
"teams": {
"type": "linkMultiple",
"readOnly": true
@@ -110,6 +118,12 @@
"foreign": "calendars",
"entity": "WorkingTimeRange"
},
"users": {
"type": "hasMany",
"foreign": "workingTimeCalendar",
"entity": "User",
"readOnly": true
},
"teams": {
"type": "hasMany",
"foreign": "workingTimeCalendar",

View File

@@ -79,6 +79,16 @@
}
]
}
},
"isDefault": {
"visible": {
"conditionGroup": [
{
"type": "isNotEmpty",
"attribute": "id"
}
]
}
}
}
}