This commit is contained in:
Thomas Peterson 2026-02-26 18:06:56 +01:00
parent 211562f917
commit d7748173a0
12 changed files with 275 additions and 21 deletions

View File

@ -1,6 +1,13 @@
const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet, reOrder, reOrderOrder, reOrderPos }, orderUuid) => `
<div class="px-6 py-4 bg-gray-50" style="${psc.order.get_pos_bg_color(status)}">
<div class="grid grid-cols-12 gap-4 w-full" id="row-${uuid}">
<div class="flex gap-4 items-start" id="row-${uuid}">
<div class="shrink-0 w-28 h-28 rounded-md border-2 border-dashed border-gray-300 bg-white flex flex-col items-center justify-center text-gray-400">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-7 h-7 mb-1">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z" />
</svg>
<span class="text-xs">Vorschau</span>
</div>
<div class="grid grid-cols-12 gap-4 flex-1">
<div class="col-span-1">
<span class="text-xs font-semibold text-gray-700">Pos:</span>
<div class="font-medium">${pos}</div>
@ -44,6 +51,7 @@ const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos
</div>
</div>
</div>
</div>
</div>
`;

View File

@ -474,7 +474,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
* datetime?: array{
* default_format?: scalar|null, // Default: "Y-m-d\\TH:i:sP"
* default_deserialization_formats?: list<scalar|null>,
* default_timezone?: scalar|null, // Default: "Europe/Berlin"
* default_timezone?: scalar|null, // Default: "UTC"
* cdata?: scalar|null, // Default: true
* },
* array_collection?: array{
@ -574,7 +574,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
* datetime?: array{
* default_format?: scalar|null, // Default: "Y-m-d\\TH:i:sP"
* default_deserialization_formats?: list<scalar|null>,
* default_timezone?: scalar|null, // Default: "Europe/Berlin"
* default_timezone?: scalar|null, // Default: "UTC"
* cdata?: scalar|null, // Default: true
* },
* array_collection?: array{

View File

@ -13,14 +13,15 @@
namespace PSC\Shop\OrderBundle\Model\Order;
use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA;
use PSC\Shop\OrderBundle\Model\Order\Position\AdditionalInfo;
use PSC\Shop\OrderBundle\Model\Order\Position\Price;
use PSC\Shop\OrderBundle\Model\Order\Position\Tracking;
use PSC\Shop\OrderBundle\Model\Order\Position\Upload;
use PSC\Shop\OrderBundle\Model\Order\Position\Upload\IUploadTypeObject;
use PSC\Shop\ProductBundle\Model\Product;
use Ramsey\Uuid\Uuid;
use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA;
class Position
{
@ -31,10 +32,10 @@ class Position
private string $uuid;
#[OA\Property(type: 'string')]
private string $customerInfo = "";
private string $customerInfo = '';
#[OA\Property(type: 'string')]
private string $uploadMode = "";
private string $uploadMode = '';
#[OA\Property(type: 'integer')]
private int $layouterMode = 0;
@ -55,10 +56,10 @@ class Position
private bool $reOrder = false;
#[OA\Property(type: 'string')]
private string $reOrderOrder = "";
private string $reOrderOrder = '';
#[OA\Property(type: 'string')]
private string $reOrderPos = "";
private string $reOrderPos = '';
#[OA\Property(type: 'boolean')]
private bool $downloadAllowed = false;
@ -81,6 +82,9 @@ class Position
#[OA\Property(type: 'array', items: new OA\Items(ref: new Model(type: Upload::class)))]
private array $uploads = [];
#[OA\Property(ref: new Model(type: IUploadTypeObject::class))]
private ?IUploadTypeObject $uploadTypeObject = null;
private $data;
#[OA\Property(type: 'string')]
@ -93,9 +97,9 @@ class Position
{
$this->uuid = Uuid::uuid4()->toString();
$this->status = 30;
$this->externalOrderNumber = "";
$this->basketField1 = "";
$this->basketField2 = "";
$this->externalOrderNumber = '';
$this->basketField1 = '';
$this->basketField2 = '';
$this->price = new Price();
}
@ -220,7 +224,7 @@ class Position
public function getCustomerInfo(): string
{
return (string)$this->customerInfo;
return (string) $this->customerInfo;
}
public function setCustomerInfo(string $var): void
@ -342,4 +346,14 @@ class Position
{
$this->trackings[] = $tracking;
}
public function getUploadTypeObject(): ?IUploadTypeObject
{
return $this->uploadTypeObject;
}
public function setUploadTypeObject(IUploadTypeObject $uploadTypeObject): void
{
$this->uploadTypeObject = $uploadTypeObject;
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace PSC\Shop\OrderBundle\Model\Order\Position\Upload;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
#[AutoconfigureTag('order.position.uploadObjectType')]
class Center implements IUploadTypeObject
{
public function getCode(): string
{
return 'center';
}
public function getName(): string
{
return 'Upload per Auftragscenter';
}
public function canPreview(): bool
{
return false;
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace PSC\Shop\OrderBundle\Model\Order\Position\Upload;
interface IUploadTypeObject
{
public function canPreview(): bool;
public function getCode(): string;
public function getName(): string;
}

View File

@ -0,0 +1,24 @@
<?php
namespace PSC\Shop\OrderBundle\Model\Order\Position\Upload;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
#[AutoconfigureTag('order.position.uploadObjectType')]
class Mail implements IUploadTypeObject
{
public function getCode(): string
{
return 'mail';
}
public function getName(): string
{
return 'Upload per Mail';
}
public function canPreview(): bool
{
return false;
}
}

View File

@ -161,7 +161,7 @@
</div>
</td>
</tr>
<tr id="rows-{{ order.uuid }}"><td colspan="12"></div></tr>
<tr id="rows-{{ order.uuid }}"><td colspan="12"></td></tr>
{% endfor %}
</tbody>
</table>

View File

@ -12,6 +12,7 @@ use PSC\Shop\OrderBundle\Transformer\Base;
use PSC\Shop\OrderBundle\Transformer\Order\Position\Product as PSCProduct;
use PSC\System\PluginBundle\Service\ProductType;
use PSC\System\SettingsBundle\Service\Shop;
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@ -25,16 +26,19 @@ class Position extends Base
protected \PSC\Shop\ProductBundle\Service\Product $productService;
private \PSC\Shop\ProductBundle\Hydrate\Product $productHydrate;
private ProductType $productTypeRegistry;
private iterable $uploadObjectTypes;
#[\Symfony\Contracts\Service\Attribute\Required]
public function setProductService(
\PSC\Shop\ProductBundle\Service\Product $productService,
ProductType $productTypeRegistry,
\PSC\Shop\ProductBundle\Hydrate\Product $productHydrate,
#[AutowireIterator('order.position.uploadObjectType')] iterable $uploadObjectTypes,
) {
$this->productService = $productService;
$this->productTypeRegistry = $productTypeRegistry;
$this->productHydrate = $productHydrate;
$this->uploadObjectTypes = $uploadObjectTypes;
}
public function toDb(
@ -95,9 +99,7 @@ class Position extends Base
/**
* Plugin Special Savings
*/
if (
$this->productTypeRegistry->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())
) {
if ($this->productTypeRegistry->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())) {
$specialProductTransformer = $this->productTypeRegistry
->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())
->getPositionProductTransformer();
@ -117,9 +119,9 @@ class Position extends Base
if ($pos->getProduct()) {
$position->setProduct($this->productHydrate->hydrateToModel($pos->getProduct()));
$tax = new Tax();
$tax->setName(((int) $pos->getProduct()->getMwert()) * 100);
$tax->setBasisAmount(((int) $pos->getPriceAllNetto()) * 100);
$tax->setCalculatedAmount(((int) $pos->getPriceAllSteuer()) * 100);
$tax->setName((int) $pos->getProduct()->getMwert() * 100);
$tax->setBasisAmount((int) $pos->getPriceAllNetto() * 100);
$tax->setCalculatedAmount((int) $pos->getPriceAllSteuer() * 100);
$position->getPrice()->setTax($tax);
} else {
$tax = new Tax();
@ -183,6 +185,11 @@ class Position extends Base
$position->setAdditionalInfos($positionDoc->getAdditionalInfos());
}
$position->setCustomerInfo((string) $positionDoc->getCustomerInfo());
var_dump(count($this->uploadObjectTypes));
var_dump($positionDoc->getUploadMode());
if ($positionDoc->getUploadMode() != '') {
}
if ($pos->getProduct()) {
if ($this->productTypeRegistry->getProductType($pos->getProduct()->getType())) {

View File

@ -14,6 +14,6 @@ class VersionTest extends WebTestCase
$this->assertResponseIsSuccessful();
$data = json_decode($client->getResponse()->getContent(), true);
$this->assertSame('2.3.2', $data['release']);
$this->assertSame('2.3.3', $data['release']);
}
}

View File

@ -0,0 +1,141 @@
<?php
namespace App\Tests\PSC\Shop\Order\Upload;
use PSC\Shop\ContactBundle\Repository\ContactRepository;
use PSC\Shop\EntityBundle\Entity\Shop;
use PSC\Shop\EntityBundle\Repository\JobRepository;
use PSC\Shop\EntityBundle\Repository\ShopRepository;
use PSC\Shop\PaymentBundle\Repository\PaymentRepository;
use PSC\Shop\ShippingBundle\Repository\ShippingRepository;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Tests\RefreshDatabaseTrait;
class CreateMailTest extends WebTestCase
{
use RefreshDatabaseTrait;
public function testCreateOrderDefault(): void
{
$client = static::createClient();
$shopRepository = static::getContainer()->get(ShopRepository::class);
/**
* @var Shop $shop
*/
$shop = $shopRepository->findOneBy(['title' => 'Printchampion']);
$shippingRepository = static::getContainer()->get(ShippingRepository::class);
$paymentRepository = static::getContainer()->get(PaymentRepository::class);
$client->jsonRequest(
'POST',
'/api/order/create',
[
'shop' => [
'uuid' => (string) $shop->getUuid(),
],
'type' => 2,
'shipping' => [
'uid' => $shippingRepository->findOneBy(['title' => 'Deutschlandweit'])->getUid(),
],
'payment' => [
'uid' => $paymentRepository->findOneBy(['title' => 'per Rechnung'])->getUid(),
],
'draft' => false,
'deliveryAddress' => [
'firstname' => 'Thomas',
'lastname' => 'Peterson',
'street' => 'Chausseestr.',
'houseNumber' => '24',
'zip' => '17506',
'city' => 'Gribow',
],
'invoiceAddress' => [
'firstname' => 'Thomas',
'lastname' => 'Peterson',
'street' => 'Chausseestr.',
'houseNumber' => '24',
'zip' => '17400',
'city' => 'Berlin',
],
'positions' => [
[
'count' => 1,
'product' => [
'title' => 'test XML',
'specialProductTypeObject' => [
'typ' => 6,
'taxClass' => 1900,
'xml' => '<?xml version="1.0" encoding="utf-8"?>
<kalkulation>
<artikel>
<name>Blocks A5 25blatt geleimt</name>
<kommentar>kein</kommentar>
<option id="auflage" name="Auflage" type="Input" width="3" require="true" default="1">
<auflage>
<grenze formel="(10*5)">1-</grenze>
</auflage>
</option>
</artikel>
</kalkulation>',
],
],
'uploadMode' => 'mail',
],
[
'count' => 1,
'product' => [
'title' => 'test Manual Position',
'specialProductTypeObject' => [
'typ' => 1,
'cent' => true,
'net' => 145,
'taxClass' => 1900,
],
],
],
],
],
['HTTP_apiKey' => $shop->getApiKey()],
);
self::assertSame(200, $client->getResponse()->getStatusCode());
$data = json_decode($client->getResponse()->getContent(), true);
$client->jsonRequest(
'POST',
'/api/order/getonebyuuid',
[
'uuid' => $data['uuid'],
],
['HTTP_apiKey' => $shop->getApiKey()],
);
$data = json_decode($client->getResponse()->getContent(), true);
var_dump($data['positions'][0]['uploadTypeObject']);
self::assertSame(7647, $data['gross']);
self::assertSame('SAN-' . date('Ym') . '-1', $data['alias']);
self::assertSame('Berlin', $data['invoiceAddress']['city']);
self::assertSame('Gribow', $data['deliveryAddress']['city']);
self::assertSame('ShopMusterOrt', $data['senderAddress']['city']);
self::assertSame('ShopMusterIban', $data['senderAddress']['iban']);
self::assertSame(200, $client->getResponse()->getStatusCode());
/**
* @var JobRepository $jobs
*/
$jobs = static::getContainer()->get(JobRepository::class);
self::assertCount(0, $jobs->findBy(['data.order' => $data['uuid']]));
}
}

View File

@ -1173,6 +1173,10 @@ html {
height: 0.5rem;
}
.h-28{
height: 7rem;
}
.h-3{
height: 0.75rem;
}
@ -1193,6 +1197,10 @@ html {
height: 1.5rem;
}
.h-7{
height: 1.75rem;
}
.h-8{
height: 2rem;
}
@ -1241,6 +1249,10 @@ html {
width: 6rem;
}
.w-28{
width: 7rem;
}
.w-3{
width: 0.75rem;
}
@ -1277,6 +1289,10 @@ html {
width: 16rem;
}
.w-7{
width: 1.75rem;
}
.w-\[var\(--sidebar-width\)\]{
width: var(--sidebar-width);
}
@ -1705,6 +1721,10 @@ html {
border-width: 0px;
}
.border-2{
border-width: 2px;
}
.border-x-0{
border-left-width: 0px;
border-right-width: 0px;
@ -1734,6 +1754,10 @@ html {
border-top-width: 1px;
}
.border-dashed{
border-style: dashed;
}
.border-blue-200{
--tw-border-opacity: 1;
border-color: rgb(191 219 254 / var(--tw-border-opacity));