{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2023 Teclib' and contributors. # @copyright 2003-2014 by the INDEPNET Development Team. # @licence https://www.gnu.org/licenses/gpl-3.0.html # # --------------------------------------------------------------------- # # LICENSE # # This file is part of GLPI. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # --------------------------------------------------------------------- #} {% import 'components/form/fields_macros.html.twig' as fields %}
{% if can_edit or can_create %}
{% endif %} {% if infocom.fields['id'] <= 0 %} {% if can_create and withtemplate != 2 %}
{% endif %} {% else %} {% set disabled = (withtemplate != 2) %} {% set disabled = false %} {% set in_modal = _get is defined and _get._in_modal|default("0") %}
{# ## LIFECYCLE PART ## #} {{ fields.largeTitle( __('Asset lifecycle'), 'fas fa-sync-alt', true ) }} {{ fields.dateField( 'order_date', infocom.fields['order_date'], __('Order date'), {'disabled': disabled} ) }} {{ fields.dateField( 'buy_date', infocom.fields['buy_date'], __('Date of purchase'), {'disabled': disabled} ) }} {{ fields.dateField( 'delivery_date', infocom.fields['delivery_date'], __('Delivery date'), {'disabled': disabled} ) }} {{ fields.dateField( 'use_date', infocom.fields['use_date'], __('Startup date'), {'disabled': disabled} ) }} {{ fields.dateField( 'inventory_date', infocom.fields['inventory_date'], __('Date of last physical inventory'), {'disabled': disabled} ) }} {{ fields.dateField( 'decommission_date', infocom.fields['decommission_date'], __('Decommission date'), {'disabled': disabled} ) }} {# ## FINANCIAL PART ## #} {{ fields.largeTitle( __('Financial and administrative information'), 'fas fa-coins' ) }} {{ fields.dropdownField( 'Supplier', 'suppliers_id', infocom.fields['suppliers_id'], 'Supplier'|itemtype_name, { 'entity' : item.fields['entities_id'], 'disabled': disabled } ) }} {% if has_itemtype_right('Budget', constant('READ')) %} {{ fields.dropdownField( 'Budget', 'budgets_id', infocom.fields['budgets_id'], 'Budget'|itemtype_name, { 'entity' : item.fields['entities_id'], 'comments': 1, 'disabled': disabled } ) }} {% endif %} {{ fields.textField( 'order_number', infocom.fields['order_number'], __('Order number'), {'disabled': disabled} ) }} {{ fields.autoNameField( 'immo_number', infocom, __('Immobilization number'), withtemplate, {'disabled': disabled, 'value': infocom.fields['immo_number']} ) }} {{ fields.textField( 'bill', infocom.fields['bill'], __('Invoice number'), {'disabled': disabled} ) }} {{ fields.textField( 'delivery_number', infocom.fields['delivery_number'], __('Delivery form'), {'disabled': disabled} ) }} {{ fields.numberField( 'value', infocom.fields['value'], _x('price', 'Value'), { 'disabled': disabled, 'step': 'any', } ) }} {{ fields.numberField( 'warranty_value', infocom.fields['warranty_value'], __('Warranty extension value'), { 'disabled': disabled, 'step': 'any', } ) }} {% set amort = infocom.Amort( infocom.fields['sink_type'], infocom.fields['value'], infocom.fields['sink_time'], infocom.fields['sink_coeff'], infocom.fields['buy_date'], infocom.fields['use_date'], config('date_tax'), 'n' ) %} {{ fields.readOnlyField( '', amort|formatted_number, __('Account net value'), ) }} {% if withtemplate == 2 or disabled == true %} {% set sink_type_field = infocom.getAmortTypeName(infocom.fields['sink_type']) %} {% else %} {% set sink_type_field = infocom.dropdownAmortType('sink_type', infocom.fields['sink_type'], false) %} {% endif %} {{ fields.field( '', sink_type_field, __('Amortization type'), ) }} {{ fields.dropdownNumberField( 'sink_time', infocom.fields['sink_time'], __('Amortization duration'), { 'max' : 15, 'unit' : 'year', 'disabled' : disabled } ) }} {{ fields.numberField( 'sink_coeff', infocom.fields['sink_coeff'], __('Amortization coefficient'), {'disabled': disabled} ) }} {% if item.getType() not in infocom.getExcludedTypes()|merge(['Cartridge', 'Consumable', 'SoftwareLicense']) %} {% set ticket_tco_value = infocom.showTco(item.fields['ticket_tco'], infocom.fields['value']) %} {{ fields.readOnlyField( 'ticket_tco', ticket_tco_value, __('TCO (value + tracking cost)'), {'disabled': disabled} ) }} {% set ticket_tco2_value = infocom.showTco(item.fields['ticket_tco'], infocom.fields['value'], infocom.fields['buy_date']) %} {{ fields.readOnlyField( 'ticket_tco', ticket_tco2_value, __('Monthly TCO'), {'disabled': disabled} ) }} {% endif %} {{ fields.dropdownField( 'BusinessCriticity', 'businesscriticities_id', infocom.fields['businesscriticities_id'], _n('Business criticity', 'Business criticities', 1), { 'disabled': disabled } ) }} {{ fields.textareaField( 'comment', infocom.fields['comment'], _n('Comment', 'Comments', get_plural_number()), {'disabled': disabled} ) }} {# ## WARRANTY PART ## #} {{ fields.largeTitle( __('Warranty information'), 'fas fa-file-contract' ) }} {{ fields.dateField( 'warranty_date', infocom.fields['warranty_date'], __('Start date of warranty'), {'disabled': disabled} ) }} {% if withtemplate == 2 %} {% if infocom.fields['warranty_duration'] == -1 %} {{ __('Lifelong') }} {% else %} {{ _n('%d month', '%d months', infocom.fields['warranty_duration'])|format(infocom.fields['warranty_duration']) }} {% endif %} {% else %} {% set warrantyexpir = infocom.getWarrantyExpir(infocom.fields['warranty_date'], infocom.fields['warranty_duration'], 0, true) %} {{ fields.dropdownNumberField( 'warranty_duration', infocom.fields['warranty_duration'], __('Warranty duration'), { 'min' : 0, 'max' : 120, 'step' : 1, 'toadd' : {'-1': __('Lifelong')}, 'unit' : 'month', 'disabled' : disabled, 'add_field_html' : '' ~ __('Valid to %s')|format(warrantyexpir) ~ '' } ) }} {% endif %} {{ fields.textField( 'warranty_info', infocom.fields['warranty_info'], __('Warranty information'), {'disabled': disabled} ) }} {% if config('use_notifications') %} {% set alert_html %} {% do call('Alert::displayLastAlert', ['Infocom', infocom.fields['id']]) %} {% endset %} {% set alert_field = infocom.dropdownAlert({ 'name' : 'alert', 'value' : infocom.fields['alert'], 'display': false, 'width' : '100%', 'class' : 'form-select' }) %} {{ fields.field( 'alert', alert_field, __('Alarms on financial and administrative information'), {'add_field_html': '' ~ alert_html ~ ''} ) }} {% endif %} {% do call_plugin_hook_func(constant('Glpi\\Plugin\\Hooks::INFOCOM'), item) %}
{% if can_global_update %} {% endif %} {% if can_global_purge %} {% endif %}
{% endif %} {% if can_edit or can_create %}
{% endif %}