parent
db9c99390e
commit
da90b0c533
|
@ -90,6 +90,45 @@ final class worker extends core
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate identifier
|
||||||
|
*
|
||||||
|
* @param array &$errors Реестр ошибок
|
||||||
|
*
|
||||||
|
* @return int Идентиикатор (свободный)
|
||||||
|
*/
|
||||||
|
public static function id(array &$errors = []): int
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (collection::init(static::$arangodb->session, static::COLLECTION)) {
|
||||||
|
// Инициализирована коллекция
|
||||||
|
|
||||||
|
// Exit (success)
|
||||||
|
return collection::search(
|
||||||
|
static::$arangodb->session,
|
||||||
|
sprintf(
|
||||||
|
<<<'AQL'
|
||||||
|
RETURN MAX((FOR d in %s RETURN +d.id))
|
||||||
|
AQL,
|
||||||
|
$collection ?? static::COLLECTION
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else throw new exception('Не удалось инициализировать коллекцию');
|
||||||
|
} catch (exception $e) {
|
||||||
|
// Запись в реестр ошибок
|
||||||
|
$errors[] = [
|
||||||
|
'text' => $e->getMessage(),
|
||||||
|
'file' => $e->getFile(),
|
||||||
|
'line' => $e->getLine(),
|
||||||
|
'stack' => $e->getTrace()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exit (fail)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Записать
|
* Записать
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,37 +2,46 @@
|
||||||
{% for row in rows %}
|
{% for row in rows %}
|
||||||
<div id="{{ row.account._key }}"
|
<div id="{{ row.account._key }}"
|
||||||
class="row{% if row.account.active is same as(true) %} active{% else %} hided{% endif %}" data-row="worker">
|
class="row{% if row.account.active is same as(true) %} active{% else %} hided{% endif %}" data-row="worker">
|
||||||
<span class="unselectable interactive" data-column="account" title="Настройки аккаунта" onclick="workers.account.update(this.parentElement)">{{
|
<span class="unselectable interactive" data-column="account" title="Настройки аккаунта"
|
||||||
|
onclick="workers.account.update(this.parentElement)">{{
|
||||||
row.account._key }}</span>
|
row.account._key }}</span>
|
||||||
<span class="unselectable interactive" data-column="worker" title="Настройки сотрудника" onclick="workers.update(this.parentElement)">{{
|
<span class="unselectable interactive" data-column="worker" title="Настройки сотрудника"
|
||||||
|
onclick="workers.update(this.parentElement)">{{
|
||||||
row.worker.id }}</span>
|
row.worker.id }}</span>
|
||||||
<span class="unselectable interactive" data-column="name"
|
<span class="unselectable interactive" data-column="name"
|
||||||
title="{% if row.worker.name.first is not empty %}{{ row.worker.name.first }}{% endif %}{% if row.worker.name.second is not empty %} {{ row.worker.name.second }}{% endif %}{% if row.worker.name.last is not empty %} {{ row.worker.name.last }}{% endif %}{% if row.worker.birth is not empty %} {{ row.worker.birth|date('d.m.Y') }}{% endif %}" onclick="navigator.clipboard.writeText('{% if row.worker.name.first is not empty %}{{ row.worker.name.first }}{% endif %}{% if row.worker.name.second is not empty %} {{ row.worker.name.second }}{% endif %}{% if row.worker.name.last is not empty %} {{ row.worker.name.last }}{% endif %}{% if row.worker.birth is not empty %} {{ row.worker.birth|date('d.m.Y') }}{% endif %}')">{%
|
title="{% if row.worker.name.first is not empty %}{{ row.worker.name.first }}{% endif %}{% if row.worker.name.second is not empty %} {{ row.worker.name.second }}{% endif %}{% if row.worker.name.last is not empty %} {{ row.worker.name.last }}{% endif %}{% if row.worker.birth is not empty %} {{ row.worker.birth|date('d.m.Y') }}{% endif %}"
|
||||||
|
onclick="navigator.clipboard.writeText('{% if row.worker.name.first is not empty %}{{ row.worker.name.first }}{% endif %}{% if row.worker.name.second is not empty %} {{ row.worker.name.second }}{% endif %}{% if row.worker.name.last is not empty %} {{ row.worker.name.last }}{% endif %}{% if row.worker.birth is not empty %} {{ row.worker.birth|date('d.m.Y') }}{% endif %}')">{%
|
||||||
if row.worker.name.first is not empty %}{{
|
if row.worker.name.first is not empty %}{{
|
||||||
row.worker.name.first|slice(0, 1)|upper }}.{% endif %}{% if row.worker.name.last is not empty %} {{
|
row.worker.name.first|slice(0, 1)|upper }}.{% endif %}{% if row.worker.name.last is not empty %} {{
|
||||||
row.worker.name.last|slice(0, 1)|upper }}.{% endif %}{% if row.worker.name.second is not empty %} {{
|
row.worker.name.last|slice(0, 1)|upper }}.{% endif %}{% if row.worker.name.second is not empty %} {{
|
||||||
row.worker.name.second }}{% endif %}</span>
|
row.worker.name.second }}{% endif %}</span>
|
||||||
<span class="unselectable interactive" data-column="number"><a href="tel:{{ row.worker.number }}"
|
<span class="unselectable interactive" data-column="number"><a href="tel:{{ row.worker.number }}" title="Позвонить">{{
|
||||||
title="Позвонить">{{ row.worker.number|storaged_number_to_readable }}</a></span>
|
row.worker.number|storaged_number_to_readable }}</a></span>
|
||||||
<span class="unselectable interactive" data-column="mail"><a href="mailto:{{ row.worker.mail }}"
|
<span class="unselectable interactive" data-column="mail"><a href="mailto:{{ row.worker.mail }}" title="Написать">{{
|
||||||
title="Написать">{{ row.worker.mail }}</a></span>
|
row.worker.mail }}</a></span>
|
||||||
<span class="unselectable interactive" data-column="address"
|
<span class="unselectable interactive" data-column="address"
|
||||||
title="{{ (row.worker.city ~ ' ' ~ row.worker.district ~ ' ' ~ row.worker.address)|trim }}"
|
title="{{ (row.worker.city ~ ' ' ~ row.worker.district ~ ' ' ~ row.worker.address)|trim }}"
|
||||||
onclick="navigator.clipboard.writeText('{{ row.worker.city ~ ' ' ~ row.worker.district ~ ' ' ~ row.worker.address }}')">{% if row.worker.city is not empty and row.worker.district is not
|
onclick="navigator.clipboard.writeText('{{ row.worker.city ~ ' ' ~ row.worker.district ~ ' ' ~ row.worker.address }}')">{%
|
||||||
|
if row.worker.city is not empty and row.worker.district is not
|
||||||
empty and row.worker.district is not null %}{{ row.worker.city|slice(0,4) ~ '. ' ~ row.worker.district|slice(0,3) ~
|
empty and row.worker.district is not null %}{{ row.worker.city|slice(0,4) ~ '. ' ~ row.worker.district|slice(0,3) ~
|
||||||
'. ' ~ row.worker.address }}{% else %}{{ row.worker.city ~ ' ' ~ row.worker.district ~ ' ' ~ row.worker.address }}{%
|
'. ' ~ row.worker.address }}{% else %}{{ row.worker.city ~ ' ' ~ row.worker.district ~ ' ' ~ row.worker.address }}{%
|
||||||
endif %}</span>
|
endif %}</span>
|
||||||
<span class="unselectable interactive" data-column="passport"
|
<span class="unselectable interactive" data-column="passport"
|
||||||
title="{{ (row.worker.passport ~ ', ' ~ row.worker.issued|date('d.m.Y') ~ ', ' ~ row.worker.department.number ~ ', ' ~ row.worker.department.address)|trim(', ') }}"
|
title="{{ (row.worker.passport ~ ', ' ~ row.worker.issued|date('d.m.Y') ~ ', ' ~ row.worker.department.number ~ ', ' ~ row.worker.department.address)|trim(', ') }}"
|
||||||
onclick="navigator.clipboard.writeText('{{ (row.worker.passport ~ ', ' ~ row.worker.issued|date('d.m.Y') ~ ', ' ~ row.worker.department.number ~ ', ' ~ row.worker.department.address)|trim(', ') }}')">{{ (row.worker.passport ~ ', ' ~ row.worker.issued|date('d.m.Y') ~ ', ' ~ row.worker.department.number ~ ', ' ~
|
onclick="navigator.clipboard.writeText('{{ (row.worker.passport ~ ', ' ~ row.worker.issued|date('d.m.Y') ~ ', ' ~ row.worker.department.number ~ ', ' ~ row.worker.department.address)|trim(', ') }}')">{{
|
||||||
|
(row.worker.passport ~ ', ' ~ row.worker.issued|date('d.m.Y') ~ ', ' ~ row.worker.department.number ~ ', ' ~
|
||||||
row.worker.department.address)|trim(', ') }}</span>
|
row.worker.department.address)|trim(', ') }}</span>
|
||||||
<span class="unselectable interactive" data-column="tax" onclick="navigator.clipboard.writeText('{{ row.worker.tax }}')">{{ row.worker.tax }}</span>
|
<span class="unselectable interactive" data-column="tax"
|
||||||
|
onclick="navigator.clipboard.writeText('{{ row.worker.tax }}')">{{ row.worker.tax }}</span>
|
||||||
<span class="unselectable interactive" data-column="requisites"
|
<span class="unselectable interactive" data-column="requisites"
|
||||||
title="{% if row.worker.requisites is not empty and row.worker.payment is not empty %}{{ row.worker.requisites }} ({{ row.worker.payment }}){% else %}{{ row.worker.payment }}{% endif %}"
|
title="{% if row.worker.requisites is not empty and row.worker.payment is not empty %}{{ row.worker.requisites }} ({{ row.worker.payment }}){% else %}{{ row.worker.requisites }} {{ row.worker.payment }}{% endif %}"
|
||||||
onclick="navigator.clipboard.writeText('{{ row.worker.requisites|storaged_requisites_to_card }}')">{% if
|
onclick="navigator.clipboard.writeText('{{ row.worker.requisites|storaged_requisites_to_card }}')">
|
||||||
row.worker.requisites is not empty and row.worker.payment is not empty %}{{
|
{% if row.worker.requisites is not empty and row.worker.payment is not empty %}
|
||||||
row.worker.requisites|storaged_requisites_preview }} ({{
|
{{ row.worker.requisites|storaged_requisites_preview }} ({{ row.worker.payment }})
|
||||||
row.worker.payment }}){% else %}{{ row.worker.payment }}{% endif %}</span>
|
{% else %}
|
||||||
|
{{ row.worker.requisites }} {{ row.worker.payment }}
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
<span class="unselectable interactive" data-column="commentary" title="{{ row.account.commentary }}"
|
<span class="unselectable interactive" data-column="commentary" title="{{ row.account.commentary }}"
|
||||||
onclick="navigator.clipboard.writeText('{{ row.account.commentary }}')">{{ row.account.commentary }}</span>
|
onclick="navigator.clipboard.writeText('{{ row.account.commentary }}')">{{ row.account.commentary }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in New Issue