From: marina Date: Mon, 26 May 2025 10:12:23 +0000 (+0300) Subject: суммирование возвратов и вычитание продаж X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=02c21c76a91934aeefd99656ed422100aaa42500;p=erp24_rep%2Fyii-erp24%2F.git суммирование возвратов и вычитание продаж --- diff --git a/erp24/views/write_offs_erp/_form.php b/erp24/views/write_offs_erp/_form.php index 1aa13999..ec59f13d 100644 --- a/erp24/views/write_offs_erp/_form.php +++ b/erp24/views/write_offs_erp/_form.php @@ -186,7 +186,7 @@ JS 'capture' => '', 'class' => 'file', 'required' => true, - ], + ], 'pluginOptions' => [ 'showPreview' => true, 'showCaption' => true, // ✅ Должно быть true @@ -270,21 +270,7 @@ JS 'entity_id' => $data['id'] ]); - if (!$file) return null; - - $initialPreview = [$file->url]; - $initialPreviewConfig = [[ - 'type' => 'video', - 'caption' => basename($file->url), - 'url' => Url::to(['delete-video', 'id' => $data['id']]) - ]]; - - return [ - 'caption' => basename($file->url), - 'url' => $file->url, - 'initialPreview' => $initialPreview, - 'initialPreviewConfig' => $initialPreviewConfig - ]; + return $file ? $file->url : null; // Return just the URL string }, 'options' => [ 'options' => [ @@ -301,6 +287,26 @@ JS 'allowedFileTypes' => ['video'], 'allowedFileExtensions' => ['mp4', 'mov', 'avi'], 'maxFileSize' => 10240, + 'initialPreview' => function ($data) { + if (!$data || !isset($data['id'])) return []; + $file = Files::findOne([ + 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO, + 'entity_id' => $data['id'] + ]); + return $file ? [$file->url] : []; + }, + 'initialPreviewConfig' => function ($data) { + if (!$data || !isset($data['id'])) return []; + $file = Files::findOne([ + 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO, + 'entity_id' => $data['id'] + ]); + return $file ? [[ + 'type' => 'video', + 'caption' => basename($file->url), + 'url' => Url::to(['delete-video', 'id' => $data['id']]) + ]] : []; + } ], ], ],