<?php
declare(strict_types=1);
namespace App\Admin;
use App\DTO\RelojPrecioCompraDTO;
use App\Entity\CCAA;
use App\Entity\EstadoOperacion;
use App\Entity\Firmante;
use App\Entity\Intercambio;
use App\Entity\Operacion;
use App\Entity\Provincia;
use App\Entity\UnidadNegocio;
use App\Entity\Usuario;
use App\Enum\EstadoOperacionEnum;
use App\Enum\IdiomaEnum;
use App\Enum\TipoOperacionEnum;
use App\Form\Type\HTMLType;
use App\Form\Type\ScriptType;
use App\Handler\Reloj\ActualizarPrecioCompra\ActualizarPrecioCompraRelojCommand;
use App\Handler\Reloj\ActualizarPrecioCompra\ActualizarPrecioCompraRelojCommandHandler;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridInterface;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Form\Type\ModelListType;
use Sonata\AdminBundle\Form\Type\Operator\EqualOperatorType;
use Sonata\AdminBundle\Route\RouteCollectionInterface;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery;
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
use Sonata\Form\Type\CollectionType;
use Sonata\Form\Type\DatePickerType;
use Sonata\Form\Type\DateRangePickerType;
use Sonata\Form\Type\DateTimePickerType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
use Symfony\Component\Security\Core\Security;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
use Vich\UploaderBundle\Form\Type\VichFileType;
final class OperacionAdmin extends AbstractAdmin
{
public function __construct(
string $code,
string $class,
string $baseControllerName,
private Security $security,
private EntityManagerInterface $em,
private ActualizarPrecioCompraRelojCommandHandler $actualizarPrecioCompraRelojCommandHandler
) {
parent::__construct($code, $class, $baseControllerName);
$this->setTranslationDomain('operacionAdmin');
}
public function configureRoutes(RouteCollectionInterface $collection): void
{
$collection->add('contract');
$collection->add('delivery');
$collection->add('proforma');
$collection->add('cancel-reloj');
$collection->add('upload-contract');
// $collection->add('card');
// $collection->add('send');
$collection->add('in-process');
$collection->add('processed');
$collection->add('confirmed');
$collection->add('settle');
$collection->add('finish');
$collection->add('cancel');
$collection->add('switch-valoracion');
$collection->add('control-unconfirmed');
parent::configureRoutes($collection);
}
protected function configureQuery(ProxyQueryInterface $query): ProxyQueryInterface
{
$query = $this->em->getRepository(Operacion::class)->qbAllDetail();
return parent::configureQuery(new ProxyQuery($query));
}
public function configureExportFields(): array
{
return [
$this->getTranslator()->trans('export.operacion.idperseo', [], 'operacionAdmin') => 'IDperseo',
$this->getTranslator()->trans('export.operacion.valoracion_idperseo', [], 'operacionAdmin') => 'valoracionIDperseo',
$this->getTranslator()->trans('export.operacion.estado_nombre', [], 'operacionAdmin') => 'estadoKey',
$this->getTranslator()->trans('export.operacion.cliente', [], 'operacionAdmin') => 'clienteRazonSocial',
$this->getTranslator()->trans('export.operacion.canal', [], 'operacionAdmin') => 'canalNombre',
$this->getTranslator()->trans('export.operacion.fecha_en_tramitacion', [], 'operacionAdmin') => 'fechaEnTramitacion',
$this->getTranslator()->trans('export.operacion.fecha_tramitacion', [], 'operacionAdmin') => 'fechaTramitacion',
$this->getTranslator()->trans('export.operacion.fecha_confirmacion', [], 'operacionAdmin') => 'fechaConfirmacion',
$this->getTranslator()->trans('export.operacion.detalle_reloj_idperseo', [], 'operacionAdmin') => 'detalleRelojIDperseo',
$this->getTranslator()->trans('export.operacion.detalle_reloj_marca_nombre', [], 'operacionAdmin') => 'detalleRelojMarcaNombre',
$this->getTranslator()->trans('export.operacion.detalle_reloj_modelo1', [], 'operacionAdmin') => 'detalleRelojModelo1',
$this->getTranslator()->trans('export.operacion.detalle_reloj_ref1', [], 'operacionAdmin') => 'detalleRelojRef1',
$this->getTranslator()->trans('export.operacion.detalle_coste', [], 'operacionAdmin') => 'detalleCoste',
$this->getTranslator()->trans('export.operacion.detalle_precio_venta', [], 'operacionAdmin') => 'detallePrecioVenta',
$this->getTranslator()->trans('export.operacion.usuario_idperseo', [], 'operacionAdmin') => 'usuarioIDperseo',
$this->getTranslator()->trans('export.operacion.user_username', [], 'operacionAdmin') => 'userUsername',
$this->getTranslator()->trans('export.operacion.user_email', [], 'operacionAdmin') => 'userEmail',
$this->getTranslator()->trans('export.operacion.user_nombre', [], 'operacionAdmin') => 'userNombre',
$this->getTranslator()->trans('export.operacion.user_primer_apellido', [], 'operacionAdmin') => 'userPrimerApellido',
$this->getTranslator()->trans('export.operacion.user_segundo_apellido', [], 'operacionAdmin') => 'userSegundoApellido',
];
}
protected function configureDefaultFilterValues(array &$filterValues): void
{
$filterValues = [
'estado' => [
'type' => EqualOperatorType::TYPE_EQUAL,
'value' => [ EstadoOperacionEnum::ESTADO_EN_TRAMITACION, EstadoOperacionEnum::ESTADO_TRAMITADA ]
],
];
parent::configureDefaultFilterValues($filterValues); // TODO: Change the autogenerated stub
}
protected function configureDefaultSortValues(array &$sortValues): void
{
parent::configureDefaultSortValues($sortValues);
$sortValues[DatagridInterface::PER_PAGE] = 50;
$sortValues[DatagridInterface::SORT_ORDER] = 'DESC';
$sortValues[DatagridInterface::SORT_BY] = 'operacion.estadofecha';
}
protected function configureDatagridFilters(DatagridMapper $filter): void
{
if(!@$_REQUEST['filter'][DatagridInterface::PER_PAGE]) $this->getDatagrid()->setValue(DatagridInterface::PER_PAGE, null, 50);
$choicesUsuarioS = [$this->em->getReference(Usuario::class, 0)];
//if ($this->security->isGranted('ROLE_SUPER_ADMIN')) {
$choicesUsuarioS = array_merge($choicesUsuarioS,
$this->em->getRepository(Usuario::class)->findAll() ?? []);
/*} else {
$choicesUsuarioS = array_merge($choicesUsuarioS,
$this->em->getRepository(Usuario::class)->getUsuariosByUnidadNegocio($this->security->getUser()->getUsuario()?->getUnidadNegocio()));
}*/
$filter
->add('busqueda', CallbackFilter::class, [
'label' => null,
'attr' => [
'class' => 'filter-to-navbar-left filter-to-navbar',
'data-order' => '1',
'placeholder' => 'filter.placeholder.busqueda',
],
'callback' => function ($queryBuilder, $alias, $field, $value) {
if (!$value->hasValue()) {
return;
}
$this->em->getRepository(Operacion::class)->cbFilter($queryBuilder, $alias, $field,
$value);
return true;
},
])
->add('tipo', CallbackFilter::class, [
'label' => false,
'attr' => [
'class' => 'filter-to-navbar-right filter-to-navbar',
'data-order' => '1',
'data-id' => 'filter-filters'
],
'callback' => function ($queryBuilder, $alias, $field, $value) {
if (!$value->hasValue()) {
return;
}
$this->em->getRepository(Operacion::class)->cbFilter($queryBuilder, $alias, $field, $value);
return true;
},
], [
'field_type' => ChoiceType::class,
'field_options' => [
'choices' => array_keys(TipoOperacionEnum::getOperaciones()),
'multiple' => true,
'expanded' => true,
'choice_label' => function ($choice, $key, $value) {
return $this->getTranslator()->trans(TipoOperacionEnum::getOperacion($choice), [], 'enum');
},
]
])
->add('estado', CallbackFilter::class, [
'label' => false,
'attr' => [
'class' => 'filter-to-navbar-right filter-to-navbar',
'data-order' => '2',
'data-id' => 'filter-filters'
],
'callback' => function ($queryBuilder, $alias, $field, $value) {
if (!$value->hasValue()) {
return;
}
$this->em->getRepository(Operacion::class)->cbFilter($queryBuilder, $alias, $field, $value);
return true;
},
], [
'field_type' => ChoiceType::class,
'field_options' => [
'choices' => array_keys(EstadoOperacionEnum::getEstados()),
'multiple' => true,
'expanded' => true,
'choice_label' => function ($choice, $key, $value) {
return $this->getTranslator()->trans(EstadoOperacionEnum::getEstado($choice), [], 'enum');
},
]
])
;
$filter
->add('usuario', CallbackFilter::class, [
'label' => false,
'attr' => [
'data-order' => '1',
],
'callback' => function ($queryBuilder, $alias, $field, $value) {
if (!$value->hasValue()) {
return;
}
$this->em->getRepository(Operacion::class)->cbFilter($queryBuilder, $alias, $field,
$value);
return true;
},
], [
'field_type' => ChoiceType::class,
'field_options' => [
'choices' => $choicesUsuarioS,
'multiple' => false,
'expanded' => true,
'choice_value' => function ($choice) {
return $choice ? $choice->getId() : 0;
},
'choice_label' => function ($choice, $key, $value) {
return $value != 0 ? $choice->getUser()->getIniciales() : 'filter.operacion.usuarios.label.all';
},
'choice_attr' => function ($choice, $key, $value) {
return [
'selected' => $value == 0
];
},
]
])
->add('fecha', CallbackFilter::class, [
'label' => false,
'attr' => [
'data-order' => '2',
'class' => 'filter-date-range'
],
'field_type' => DateRangePickerType::class,
'field_options' => [
'field_options_start' => [
'label' => false,
'format' => 'dd/MM/yyyy',
'attr' => ['placeholder' => 'filter.operacion.placeholder.fecha_start']
],
'field_options_end' => [
'label' => false,
'format' => 'dd/MM/yyyy',
'attr' => ['placeholder' => 'filter.operacion.placeholder.fecha_end']
]
],
'callback' => function ($queryBuilder, $alias, $field, $value) {
if (!$value->hasValue()) {
return;
}
$this->em->getRepository(Operacion::class)->cbFilter($queryBuilder, $alias, $field,
$value);
return true;
}
])
;
}
protected function configureListFields(ListMapper $list): void
{
$this->setTranslationDomain('operacionAdmin');
$list
->add('IDperseo', null, [
'label' => 'list.operacion.label.idperseo',
'header_style' => 'width: 95px',
'template' => 'admin/CRUD/Operacion/list_field_identifier_idperseo.html.twig',
])
/*->add('valoracionIDperseo', null, [
'label' => 'list.operacion.label.valoracion_idperseo',
'header_style' => 'width: 110px',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'valoracionIDperseo'],
'sort_parent_association_mappings' => [],
'template' => 'admin/CRUD/Operacion/list_field_identifier_valoracion_idperseo.html.twig',
])*/
->add('tipo', null, [
'label' => 'list.operacion.label.tipo',
'header_style' => 'width: 75px',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'tipo'],
'sort_parent_association_mappings' => [],
])
->add('estadoFecha', 'datetime', [
'label' => 'list.operacion.label.estado_fecha',
'header_style' => 'width: 90px;word-break: break-word;',
'format' => 'd/m/Y',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'estadoFecha'],
'sort_parent_association_mappings' => [],
])
->add('estadoNombre', 'trans', [
'label' => 'list.operacion.label.estado',
'header_style' => 'width: 110px',
'translationDomain' => 'enum',
'collapse' => [
// height in px
'height' => 20,
// content of the "read more" link
'more' => '[+]',
// content of the "read less" link
'less' => '[-]',
],
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'estadoNombre'],
'sort_parent_association_mappings' => [],
])
// ->add('detalleRelojIDperseo', null, [
// 'label' => 'list.operacion.label.detalle_reloj_idreloj',
// 'header_style' => 'width: 110px',
// 'sortable' => true,
// 'sort_field_mapping' => ['fieldName' => 'detalleRelojIDperseo'],
// 'sort_parent_association_mappings' => [],
// 'template' => 'admin/CRUD/Operacion/list_field_identifier_detalle_reloj_idperseo.html.twig',
// ])
->add('detalleRelojCodigo', null, [
'label' => 'list.operacion.label.detalle_reloj_codigo',
'header_style' => 'width: 90px',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'detalleRelojCodigo'],
'sort_parent_association_mappings' => [],
'template' => 'admin/CRUD/Operacion/list_field_identifier_detalle_reloj_codigo.html.twig',
])
->add('detalleRelojMarcaNombre', null, [
'label' => 'list.operacion.label.detalle_reloj_marca',
'header_style' => 'min-width: 75px',
'collapse' => [
// height in px
'height' => 20,
// content of the "read more" link
'more' => '[+]',
// content of the "read less" link
'less' => '[-]',
],
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'detalleRelojMarcaNombre'],
'sort_parent_association_mappings' => [],
'template' => 'admin/CRUD/list_field_collapse.html.twig',
])
->add('detalleRelojModelos', null, [
'label' => 'list.operacion.label.detalle_reloj_modelos',
'header_style' => 'min-width: 75px',
'collapse' => [
// height in px
'height' => 20,
// content of the "read more" link
'more' => '[+]',
// content of the "read less" link
'less' => '[-]',
],
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'detalleRelojModelo1'],
'sort_parent_association_mappings' => [],
'template' => 'admin/CRUD/list_field_collapse.html.twig',
])
->add('detalleRelojRef1', null, [
'label' => 'list.operacion.label.detalle_reloj_ref1',
'header_style' => 'width: 75px',
'collapse' => [
// height in px
'height' => 20,
// content of the "read more" link
'more' => '[+]',
// content of the "read less" link
'less' => '[-]',
],
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'detalleRelojRef1'],
'sort_parent_association_mappings' => [],
'template' => 'admin/CRUD/list_field_collapse.html.twig',
])
->add('detallePrecioCoste', null, [
'label' => 'list.operacion.label.detalle_precio_coste',
'header_style' => 'width: 90px;word-break: break-word;',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'detallePrecioCoste'],
'sort_parent_association_mappings' => [],
'template' => 'admin/CRUD/list_field_currency.html.twig',
])
->add('detallePrecioVenta', null, [
'label' => 'list.operacion.label.detalle_precio_venta',
'header_style' => 'width: 90px;word-break: break-word;',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'detallePrecioVenta'],
'sort_parent_association_mappings' => [],
'template' => 'admin/CRUD/list_field_currency.html.twig',
])
->add('clienteRazonSocial', null, [
'label' => 'list.operacion.label.cliente',
//'header_style' => 'width: 150px',
'collapse' => [
// height in px
'height' => 20,
// content of the "read more" link
'more' => '[+]',
// content of the "read less" link
'less' => '[-]',
],
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'clienteRazonSocial'],
'sort_parent_association_mappings' => [],
'template' => 'admin/CRUD/list_field_collapse.html.twig',
])
->add('canalNombre', null, [
'label' => 'list.operacion.label.canal',
'header_style' => 'width: 90px',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'canalNombre'],
'sort_parent_association_mappings' => [],
])
;
}
protected function configureFormFields(FormMapper $form): void
{
$this->setTranslationDomain('operacionAdmin');
$object = $this->getSubject();
if(!$object->getId())
{
$estado = $this->em->getRepository(EstadoOperacion::class)->findOneBy(['key' => EstadoOperacionEnum::ESTADO_EN_TRAMITACION]);
$object->setEstado($estado);
}
$mappedCliente = $object->getCliente()?->getId() ? true : false;
$compras = $object?->getCompra()?->getDetalle();
$ventas = $object?->getVenta()?->getDetalle();
$idioma = IdiomaEnum::IDIOMA_ES;
$fecha = new DateTime();
$user = $this->security->getUser();
$usuario = $user?->getUsuario();
$unidadNegocio = $usuario?->getUnidadNegocio();
$estadoOperacion = $object?->getEstado()?->getKey();
if ($unidadNegocio) {
$unidadNegocio = $this->em
->getRepository(UnidadNegocio::class)
->find($unidadNegocio->getId());
}
if ($usuario) {
$usuario = $this->em
->getRepository(Usuario::class)
->find($usuario->getId());
}
$classGestionVentaMoreInfo = ($object->getTipo() === TipoOperacionEnum::OPERACION_GESTION &&
$estadoOperacion &&
($estadoOperacion === EstadoOperacionEnum::ESTADO_CONFIRMADA || $estadoOperacion === EstadoOperacionEnum::ESTADO_FINALIZADA)
) ? 'more-info-fechas' : '';
$classAccessAdmin = $this->security->isGranted('ROLE_SUPER_ADMIN') ? 'access-admin' : '';
$updateDataInfoSend = $this->isUpdateDataInfoSend();
$classNoBlockFechaEnTramitacion = $object->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_EN_TRAMITACION ? 'no-block' : 'readonly';
$classNoBlockFechaTramitada = in_array($object->getEstado()?->getKey(), [ EstadoOperacionEnum::ESTADO_EN_TRAMITACION, EstadoOperacionEnum::ESTADO_TRAMITADA ]) ? 'no-block' : 'readonly';
$classNoBlockFechaConfirmada = in_array($object->getEstado()?->getKey(), [ EstadoOperacionEnum::ESTADO_TRAMITADA, EstadoOperacionEnum::ESTADO_CONFIRMADA ]) ? 'no-block' : 'readonly';
$classOperacionExportacion = $object->getExportacion() ? 'operacion-exportacion' : '';
$form
->with('with_operacion', [
'label' => false,
'class' => $this->isReadonly() ? 'col-md-12 with readonly' : 'col-md-12'
])
->add('IDperseo', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'required' => false,
'disabled' => true,
'attr' => [
'placeholder' => 'form.operacion.placeholder.id_perseo',
],
/*], [
'more_info' => [
'data-input-field' => 'info_valoracion',
'data-input-field-value' => $this->getSubject()->getInfoValoracion()
]*/
])
;
if($object->getId() && $object->getValoracion()) {
$form
->add('valoracion.IDperseo', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'required' => false,
'disabled' => true,
'attr' => [
'placeholder' => 'form.operacion.placeholder.valoracion.id_perseo',
],
]);
}
$form
->add('fecha', DateTimePickerType::class, [
'label' => false,
'translation_domain' => 'operacionAdmin',
//'disabled' => true,
'format' => 'dd-MM-yyyy HH:mm',
'data' => $object->getFecha() ? $object->getFecha() : $fecha,
'attr' => [
'readonly' => true,
'placeholder' => 'form.operacion.placeholder.fecha',
],
'row_attr' => [
'class' => 'readonly',
]
])
->add('unidadNegocio', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
//'disabled' => true,
'placeholder' => 'form.operacion.placeholder.unidad_negocio',
'data' => $object->getUnidadNegocio() ? $object->getUnidadNegocio() : $unidadNegocio,
'choice_attr' => function ($val, $key, $index)
{
return $val?->getColor() ? [
'data-color' => $val->getColor(),
'style' => 'color: ' . $val->getColor() . ';',
] : [];
},
// 'attr' => [
// 'readonly' => true,
// ],
'row_attr' => [
'class' => 'color-unidad-negocio',
]
])
->add('usuario', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
//'disabled' => true,
'placeholder' => 'form.operacion.placeholder.usuario',
'data' => $object->getUsuario() ? $object->getUsuario() : $usuario,
'attr' => [
'readonly' => true,
],
'row_attr' => [
'class' => 'readonly',
]
])
->add('canal', ModelListType::class, [
'label' => false,
'attr' => [
'data-max_length' => 15
],
'row_attr' => [
'class' => 'display-model-list-type create-display-none control-block-unblock-fields'
],
'btn_delete' => false,
], [
'placeholder' => 'form.operacion.placeholder.canal',
'link_parameters' => [
'nav_prometeo' => true,
'model_list_type' => 'canal',
'action_create_not_list' => false,
]
])
->add('cliente', ModelListType::class, [
'label' => false,
'data_class' => null,//Cliente::class,
'data' => $object->getId() ? $object->getCliente() : null,
'attr' => [
'data-max_length' => 24
],
'row_attr' => [
'class' => "display-model-list-type create-display-none $classAccessAdmin control-block-unblock-fields"
],
'btn_delete' => false,
], [
'placeholder' => 'form.operacion.placeholder.cliente',
'link_parameters' => [
'nav_prometeo' => true,
'model_list_type' => 'cliente',
'action_create_not_list' => false,
]
])
->add('tipoCliente', null, [
'label' => 'form.operacion.label.tipo_cliente',
'translation_domain' => 'operacionAdmin',
'row_attr' => [
'class' => 'control-block-unblock-fields'
]
])
->add('exportacion', null, [
'label' => 'form.operacion.label.exportacion',
'translation_domain' => 'operacionAdmin',
'row_attr' => [
'class' => 'control-block-unblock-fields'
]
])
->add('comentario', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.comentario'
],
'row_attr' => [
'class' => $object?->getComentario() ? 'more-info more-info-modal' : 'more-info more-info-modal empty',
'more_info_class' => 'more-info-input-wrap more-info-input-wrap-modal more-info-input-wrap-right',
],
])
->add('idioma', ChoiceType::class, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'placeholder' => 'form.operacion.placeholder.idioma',
'choices' => array_flip(IdiomaEnum::getIdiomas()),
'data' => $object->getIdioma() ? $object->getIdioma() : $idioma,
'choice_label' => function ($choice, $key, $value) {
return $this->getTranslator()->trans(IdiomaEnum::getIdioma($choice), [], 'enum');
},
])
->end()
->with('with_cliente', [
'label' => false,
'class' => 'col-md-12 with readonly'
])
->add('cliente.razonSocial', null, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.razon_social'
]
])
->add('cliente.identificacion', null, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.identificacion'
]
])
->add('cliente.direccion', null, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.direccion'
]
])
->add('cliente.cp', null, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.cp'
]
])
->add('cliente.ciudad', null, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.ciudad'
]
])
->add('cliente.provincia', EntityType::class, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'class' => Provincia::class,
'placeholder' => 'form.operacion.placeholder.cliente.provincia'
])
->add('cliente.ccaa', EntityType::class, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'class' => CCAA::class,
'placeholder' => 'form.operacion.placeholder.cliente.ccaa'
])
->add('cliente.pais', CountryType::class, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'placeholder' => 'form.operacion.placeholder.cliente.pais',
'translation_domain' => 'operacionAdmin',
])
->add('cliente.telefono', null, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.telefono'
]
])
->add('cliente.email', null, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.email'
]
])
->add('cliente.entidadBancaria', null, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.entidad_bancaria'
]
])
->add('cliente.iban', null, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.iban'
]
])
->add('cliente.swift', null, [
'label' => false,
'mapped' => $mappedCliente,
'disabled' => true,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.swift'
]
])
->add('cliente.identificacionFrontal', HTMLType::class, [
'label' => false,
'mapped' => false,//$mappedCliente,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.identificacion_frontal'
],
'row_attr' => [
'class' => 'no-block',
],
'template' => 'admin/cliente/imagen.html.twig'
])
->add('cliente.identificacionTrasera', HTMLType::class, [
'label' => false,
'mapped' => false,//$mappedCliente,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.cliente.identificacion_trasera'
],
'row_attr' => [
'class' => 'no-block',
],
'template' => 'admin/cliente/imagen.html.twig'
])
->end()
->with('with_resume', [
'label' => false,
'class' => $this->isReadonly() ? 'col-md-12 with readonly' : 'col-md-12'
])
->add('fechaTramitacion', DatePickerType::class, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'format' => 'dd-MM-yyyy',
'row_attr' => [
'class' => "control-fechas-resumen $classNoBlockFechaEnTramitacion control-block-unblock-fields",
],
'attr' => [
'placeholder' => 'form.operacion.placeholder.fecha_tramitacion',
'data-control_fecha_title' => null,
'data-control_fecha_message' => null, //$this->getTranslator()->trans('message.control.fecha.valoraciones_relojes.fecha_enviada', [], 'operacionAdmin'),
]
])
->add('fechaTramitada', DatePickerType::class, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'format' => 'dd-MM-yyyy',
'row_attr' => [
'class' => "control-fechas-resumen $classNoBlockFechaTramitada control-block-unblock-fields",// readonly',
//'style' => 'pointer-events: none;'
],
'attr' => [
//'readonly' => true,
'placeholder' => 'form.operacion.placeholder.fecha_tramitada',
]
])
->add('fechaConfirmada', DatePickerType::class, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'format' => 'dd-MM-yyyy',
'row_attr' => [
'class' => "control-fechas-resumen $classNoBlockFechaConfirmada", //readonly',
//'style' => 'pointer-events: none;'
],
'attr' => [
// 'readonly' => true,
'placeholder' => 'form.operacion.placeholder.fecha_confirmada',
]
])
->add('fechaCancelada', DatePickerType::class, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'format' => 'dd-MM-yyyy',
'disabled' => true,
'datepicker_use_button' => false,
'attr' => [
'placeholder' => 'form.operacion.placeholder.fecha_cancelada',
'class' => 'bolder text-canceled'
]
])
->add('tipo', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'readonly' => true,
'placeholder' => 'form.operacion.placeholder.tipo',
'class' => 'bolder'
],
])
;
/*if($object->getEstado()?->getKey() !== EstadoOperacionEnum::ESTADO_EN_TRAMITACION &&
($object->getTipo() === TipoOperacionEnum::OPERACION_COMPRA || $object->getTipo() === TipoOperacionEnum::OPERACION_PERMUTA)
) {
$form
->add('contractSignedFile', VichFileType::class, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'required' => false,
'allow_delete' => true,
'download_uri' => true,
'download_label' => 'label.download.contract_signed',
'attr' => [
'data-translation_domain' => 'operacionAdmin',
'data-upload_label' => 'label.upload.contract_signed',
'data-selector_file_original' => 'contractSigned',
'data-title_file_delete' => null,
'data-message_file_delete' => null,
'class' => 'vich-file-load',
],
'row_attr' => [
'class' => (
$object->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_EN_TRAMITACION ||
$object->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_ASENTADA ||
$object->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_CANCELADA) ? 'block' : 'no-block',
]
]);
}*/
$form
->add('precioPagar', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'readonly' => true,
'placeholder' => 'form.operacion.placeholder.precio_pagar',
'class' => 'numeric currencies'
]
])
->add('scriptCalcularPrecioPagar', ScriptType::class, [
'template' => 'SCRIPTS/Operacion/calcular_precio_pagar.html.twig'
])
->end()
;
if ($object->getTipo() === TipoOperacionEnum::OPERACION_COMPRA || $object->getTipo() === TipoOperacionEnum::OPERACION_PERMUTA || $object->getTipo() === TipoOperacionEnum::OPERACION_GESTION) {
$form
->with('with_comerzia', [
'label' => false,
'class' => $this->isReadonly() ? 'col-md-12 with readonly' : 'col-md-12'
])
->add('intercambio', null, [
'label' => false,
'placeholder' => 'form.operacion.placeholder.intercambio',
'translation_domain' => 'operacionAdmin',
'attr' => [
'class' => 'control-select-option-active'
],
'query_builder' => $this->em->getRepository(Intercambio::class)->qbIntercambioContratoIdioma($object->getTipo(), $object->getIdioma()),
'choice_attr' => function ($choice, string $key, mixed $value) {
return [
'readonly' => !$choice->isActive(),
// 'title' => $choice->getEmail(),
];
},
])
->add('firmante', Select2EntityType::class, [
'label' => false,
'placeholder' => 'form.operacion.placeholder.firmante',
'translation_domain' => 'operacionAdmin',
'class' => Firmante::class,
'remote_route' => 'admin_app_firmante_getFirmantesByTipoIdioma',
'remote_params' => [
'idioma' => $object->getIdioma(),
'tipo' => $object->getTipo(),
'empresa' => $object->getUnidadNegocio()?->getEmpresa()?->getId()
],
'multiple' => false,
'scroll' => true,
'data_class' => null,
'minimum_input_length' => 0,
'page_limit' => 30,
'delay' => 250,
'cache' => true,
'allow_clear' => false,
'attr' => [
'class' => 'control-select-option-active',
'data-parent' => 'idioma'
],
//'query_builder' => $this->em->getRepository(Firmante::class)->qbFirmanteTipoIdioma($object->getTipo(), $object->getIdioma()),
/*'choice_attr' => function ($choice, string $key, mixed $value) {
return [
'readonly' => !$choice->isActive(),
// 'title' => $choice->getEmail(),
];
},*/
])
->add('banco', null, [
'label' => false,
'placeholder' => 'form.operacion.placeholder.banco',
'translation_domain' => 'operacionAdmin',
])
->add('comentarioContrato', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.comentario_contrato'
]
])
->end();
}
//if($compras?->count()) {
$operacionStatus = $object->getEstado()?->getKey();
$classUnblockBlock = '';// $operacionStatus === EstadoOperacionEnum::ESTADO_TRAMITADA ? 'active-unblock-block' : '';
$classOperacionStatus = $operacionStatus ? mb_strtolower("status-$operacionStatus") : '';
if($object->getTipo() !== TipoOperacionEnum::OPERACION_VENTA) {
$form
->with('with_detalle_compra', [
'label' => false,
'class' => "col-md-12 with $classUnblockBlock $classOperacionStatus $classOperacionExportacion " . ($this->isReadonly() || $object->isCompraGestion() ? 'readonly' : '')
])
->add('compra.detalle', CollectionType::class, [
'label' => false,
'row_attr' => [
'data-title_modal_record_delete' => $this->getTranslator()->trans('title.modal.record.delete.compra_detalle',
[], 'operacionAdmin'),
'data-message_modal_record_delete' => $this->getTranslator()->trans('message.modal.record.delete.compra_detalle',
[], 'operacionAdmin'),
],
'by_reference' => false,
'btn_add' => $this->security->isGranted('ROLE_SUPER_ADMIN') || $object->isCompraGestion() ? 'link_add_operacion_compra_detalle' : null,
'type_options' => [
'delete' => !$object->isCompraGestion() && $operacionStatus === EstadoOperacionEnum::ESTADO_EN_TRAMITACION && $this->security->isGranted('ROLE_SUPER_ADMIN')
],
], [
'edit' => 'inline',
'inline' => 'table',
'attr' => [
'class' => "table-operacion-compra-detalle table-view-card table-operacion-compra-detalle-view-card table-view-multiple-card $classGestionVentaMoreInfo"
],
'admin_code' => 'admin.detalle_compra',
]);
if (!$object->isCompraGestion()) {
$form
->add('scriptControlFechaVerificacion', ScriptType::class, [
'template' => 'SCRIPTS/Operacion/control_fecha_verificacion.html.twig'
]);
}
if ($object->getTipo() === TipoOperacionEnum::OPERACION_GESTION) {
$form
->add('scriptCancelarReloj', ScriptType::class, [
'template' => 'SCRIPTS/Operacion/cancelar_reloj.html.twig'
]);
}
$form
->add('scriptControlRegimen', ScriptType::class, [
'template' => 'SCRIPTS/Operacion/control_regimen.html.twig'
])
->add('scriptControlCosteImportacion', ScriptType::class, [
'template' => 'SCRIPTS/Operacion/control_coste_importacion.html.twig'
])
->end();
}
//}
// if($venta->count()/* || !$object->getId()*/) {
if($object->getTipo() !== TipoOperacionEnum::OPERACION_GESTION && !$object->isCompraGestion()) {
$form
->with('with_detalle_venta', [
'label' => false,
'class' => $this->isReadonly() ? "col-md-12 with readonly $classOperacionStatus" : "col-md-12 $classOperacionStatus"
])
->add('venta.detalle', CollectionType::class, [
'label' => false,
'row_attr' => [
'data-title_modal_record_delete' => $this->getTranslator()->trans('title.modal.record.delete.venta_detalle',
[], 'operacionAdmin'),
'data-message_modal_record_delete' => $this->getTranslator()->trans('message.modal.record.delete.venta_detalle',
[], 'operacionAdmin'),
],
'by_reference' => false,
'btn_add' => $this->security->isGranted('ROLE_SUPER_ADMIN') ? 'link_add_operacion_venta_detalle' : null,
'type_options' => [
'delete' => $operacionStatus === EstadoOperacionEnum::ESTADO_EN_TRAMITACION && $this->security->isGranted('ROLE_SUPER_ADMIN')
],
], [
'edit' => 'inline',
'inline' => 'table',
'attr' => [
'class' => 'table-operacion-venta-detalle table-view-card table-operacion-venta-detalle-view-card table-view-multiple-card'
],
'admin_code' => 'admin.detalle_venta',
])
->add('scriptEventOnChange', ScriptType::class, [
'template' => 'SCRIPTS/DetalleVenta/reloj_event_on_change.html.twig'
])
->add('scriptControlFechaEnvio', ScriptType::class, [
'template' => 'SCRIPTS/Operacion/control_fecha_envio.html.twig'
])
->end();
if (($object->getTipo() === TipoOperacionEnum::OPERACION_VENTA || $object->getTipo() === TipoOperacionEnum::OPERACION_PERMUTA) /*&&
$object->getEstado()?->getKey() !== EstadoOperacionEnum::ESTADO_EN_TRAMITACION*/
) {
$classReadonly = in_array( $object->getEstado()?->getKey(), [EstadoOperacionEnum::ESTADO_EN_TRAMITACION, EstadoOperacionEnum::ESTADO_TRAMITADA] ) ? '' : 'readonly';
$form
->with('with_info_envio', [
'label' => false,
'class' => "col-md-12 with $classReadonly"
])
->add('venta.destinatario', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.venta.destinatario'
],
'data' => $updateDataInfoSend ? $object->getCliente()?->getRazonSocial() : $object->getVenta()->getDestinatario(),
])
->add('venta.destinatarioEmpresa', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.venta.destinatario_empresa'
]
])
->add('venta.direccionEnvioDireccion1', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.venta.direccion_envio_direccion_1'
],
'data' => $updateDataInfoSend ? $object->getCliente()?->getDireccion() : $object->getVenta()->getDireccionEnvioDireccion1(),
])
->add('venta.direccionEnvioDireccion2', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.venta.direccion_envio_direccion_2'
]
])
->add('venta.direccionEnvioCp', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.venta.direccion_envio_cp'
],
'data' => $updateDataInfoSend ? $object->getCliente()?->getCp() : $object->getVenta()->getDireccionEnvioCp(),
])
->add('venta.direccionEnvioCiudad', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.venta.direccion_envio_ciudad'
],
'data' => $updateDataInfoSend ? $object->getCliente()?->getCiudad() : $object->getVenta()->getDireccionEnvioCiudad(),
])
->add('venta.direccionEnvioRegion', null, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'attr' => [
'placeholder' => 'form.operacion.placeholder.venta.direccion_envio_region'
],
'data' => $updateDataInfoSend ? $object->getCliente()?->getRegion() : $object->getVenta()->getDireccionEnvioRegion(),
])
->add('venta.direccionEnvioPais', CountryType::class, [
'label' => false,
'translation_domain' => 'operacionAdmin',
'placeholder' => 'form.operacion.placeholder.venta.direccion_envio_pais',
'data' => $updateDataInfoSend ? $object->getCliente()?->getPais() : $object->getVenta()->getDireccionEnvioPais(),
])
->add('btn_copy_data_client', HTMLType::class, [
'label' => false,
'template' => 'admin/operacion/btn_copy_data_client.html.twig'
])
->end();
}
}
//}
// ->add('valoracionesRelojesSinStocks', CollectionType::class, [
// 'label' => false,
// 'row_attr' => [
// 'data-title_modal_record_delete' => $this->getTranslator()->trans('title.modal.record.delete.valoraciones_relojes'),
//// 'data-message_modal_record_delete' => $this->getTranslator()->trans('message.modal.record.delete.valoraciones_relojes'),
// ],
// 'by_reference' => false,
// 'btn_add' => 'link_add_valoraciones_relojes_sin_stocks'
// ], [
// 'edit' => 'inline',
// 'inline' => 'table',
// 'attr' => [
// 'class' => 'table-valoraciones-relojes-sin-stocks table-view-card table-valoraciones-relojes-sin-stocks-view-card table-view-multiple-card'
// ],
// 'admin_code' => 'admin.valoraciones_relojes_sin_stock',
// ]);
//
// if (!$this->isHidden()) {
// $form
// ->add('scriptDeleteImagen', ScriptType::class, [
// 'template' => 'SCRIPTS/ValoracionesRelojesSinStock/delete_imagen.html.twig'
// ])
// ->add('scriptCalcularMargenPromocion', ScriptType::class, [
// 'template' => 'SCRIPTS/ValoracionesRelojesSinStock/calcular_margen_promocion.html.twig'
// ])
// ->add('scriptCalcularMargenMinimo', ScriptType::class, [
// 'template' => 'SCRIPTS/ValoracionesRelojesSinStock/calcular_margen_minimo.html.twig'
// ])
// ->add('scriptCalcularPrecioCosteTotal', ScriptType::class, [
// 'template' => 'SCRIPTS/ValoracionesRelojesSinStock/calcular_precio_oferta.html.twig'
// ])
// ->add('scriptCalcularCostesEventOnChangePrecio', ScriptType::class, [
// 'template' => 'SCRIPTS/ValoracionesRelojesSinStock/calcular_costes_event_on_change_precio.html.twig'
// ])
// ->add('scriptControlPrecioReferencia', ScriptType::class, [
// 'template' => 'SCRIPTS/ValoracionesRelojesSinStock/control_precio_referencia.html.twig'
// ])
// ->add('scriptControlCostesTotal', ScriptType::class, [
// 'template' => 'SCRIPTS/ValoracionesRelojesSinStock/control_costes_total.html.twig'
// ]);
// }
//
// $form
// ->add('valoracionesRelojesStocks', CollectionType::class, [
// 'label' => false,
// 'row_attr' => [
// 'class' => 'hide',
// 'data-title_modal_record_delete' => $this->getTranslator()->trans('title.modal.record.delete.valoraciones_relojes'),
// 'data-message_modal_record_delete' => $this->getTranslator()->trans('message.modal.record.delete.valoraciones_relojes'),
// ],
// 'by_reference' => false,
// 'btn_add' => 'link_add_valoraciones_relojes_stocks'
// ], [
// 'edit' => 'inline',
// 'inline' => 'table',
// 'attr' => [
// 'class' => 'table-valoraciones-relojes-stocks table-view-card table-valoraciones-relojes-stocks-view-card table-view-multiple-card table-view-carousel'
// ],
// 'admin_code' => 'admin.valoraciones_relojes_stock',
// ])
// ->end()
// ->with('with_resumen', [
// 'label' => false
// ])
// ->add('fechaEnviada', DatePickerType::class, [
// 'label' => false,
// 'placeholder' => 'form.operacion.placeholder.fecha_enviada',
// 'format' => 'dd-MM-yyyy',
// 'row_attr' => [
// 'class' => 'control-fechas-resumen',
// ],
// 'attr' => [
// 'placeholder' => 'form.operacion.placeholder.fecha_enviada',
// 'data-control_fecha_title' => null,
// 'data-control_fecha_message' => $this->getTranslator()->trans('message.control.fecha.valoraciones_relojes.fecha_enviada'),
// ]
// ])
// ->add('fechaAceptacion', DatePickerType::class, [
// 'label' => false,
// 'placeholder' => 'form.operacion.placeholder.fecha_aceptacion',
// 'format' => 'dd-MM-yyyy',
// 'row_attr' => [
// 'class' => 'control-fechas-resumen readonly',
// //'style' => 'pointer-events: none;'
// ],
// 'attr' => [
// 'readonly' => true,
// 'placeholder' => 'form.operacion.placeholder.fecha_aceptacion',
// ]
// ])
// ->add('fechaRechazo', DatePickerType::class, [
// 'label' => false,
// 'placeholder' => 'form.operacion.placeholder.fecha_rechazo',
// 'format' => 'dd-MM-yyyy',
// 'row_attr' => [
// 'class' => 'control-fechas-resumen readonly',
// //'style' => 'pointer-events: none;'
// ],
// 'attr' => [
// 'readonly' => true,
// 'placeholder' => 'form.operacion.placeholder.fecha_rechazo',
// ]
// ])
// ->add('fechaTramitacion', TextType::class, [
// 'label' => false,
// 'data' => $object->getFechaTramitacion()?->format('d-m-Y'),
// 'attr' => [
// 'readonly' => true,
// 'placeholder' => 'form.operacion.placeholder.fecha_tramitacion',
// ]
// ])
// ->add('infoTramitacion', null, [
// 'label' => false,
// 'attr' => [
// 'placeholder' => 'form.operacion.placeholder.info_tramitacion'
// ],
// 'row_attr' => [
// 'class' => 'more-info',
// 'more_info_class' => 'more-info-input-wrap more-info-input-wrap-modal more-info-input-wrap-right',
// ]
// ])
// ->add('precioPagar', null, [
// 'label' => false,
// 'attr' => [
// 'readonly' => true,
// 'placeholder' => 'form.operacion.placeholder.precio_pagar',
// 'class' => 'numeric currencies'
// ]
// ])
// ->add('scriptCalcularPrecioPagar', ScriptType::class, [
// 'template' => 'SCRIPTS/Valoracion/calcular_precio_pagar.html.twig'
// ])
// ->add('scriptRecalculosDeleteCollections', ScriptType::class, [
// 'template' => 'SCRIPTS/Valoracion/recalculos_delete_collections.html.twig'
// ])
// ->add('scriptControlFechasResumen', ScriptType::class, [
// 'template' => 'SCRIPTS/Valoracion/control_fechas_resumen.html.twig'
// ])
// ->end();
}
protected function configureShowFields(ShowMapper $show): void
{
$show
;
}
private function isReadonly()
{
$object = $this->getSubject();
return
$object->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_CANCELADA ||
// $object->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_TRAMITADA ||
$object->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_ASENTADA ||
$object->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_CONFIRMADA ||
$object->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_FINALIZADA
;
}
private function isUpdateDataInfoSend(): bool
{
$venta = $this->getSubject()?->getVenta();
return (!$venta->getDestinatario() && !$venta->getDestinatarioEmpresa() && !$venta->getDireccionEnvioDireccion1() &&
!$venta->getDireccionEnvioDireccion2() && !$venta->getDireccionEnvioCp() && !$venta->getDireccionEnvioCiudad() &&
!$venta->getDireccionEnvioRegion() && !$venta->getDireccionEnvioPais()) &&
in_array($this->getSubject()->getEstado()?->getKey(), [ EstadoOperacionEnum::ESTADO_EN_TRAMITACION, EstadoOperacionEnum::ESTADO_TRAMITADA]);
}
protected function preUpdate(object $object): void
{
parent::preUpdate($object);
$detallesCompra = $object->getCompra()?->getDetalle() ?? [];
foreach ($detallesCompra as $detalle)
{
$reloj = $detalle->getReloj();
if(!$reloj) continue;
$this->actualizarPrecioCompraRelojCommandHandler->__invoke(new ActualizarPrecioCompraRelojCommand(new RelojPrecioCompraDTO($reloj->getId(), $detalle->getPrecioCoste())));
}
}
}