Merge pull request #26 from exciler/sendcloud
Basic Sendcloud integration with Shipment rework
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
namespace Xentral\Modules\ShippingMethod\Model;
|
||||
|
||||
class CreateShipmentResult
|
||||
{
|
||||
public bool $Success = false;
|
||||
public array $Errors = [];
|
||||
public ?string $Label;
|
||||
public ?string $ExportDocuments;
|
||||
public ?string $TrackingNumber;
|
||||
public ?string $TrackingUrl;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
namespace Xentral\Modules\ShippingMethod\Model;
|
||||
|
||||
class CustomsInfo
|
||||
{
|
||||
const CUSTOMS_TYPE_GIFT = 0;
|
||||
const CUSTOMS_TYPE_DOCUMENTS = 1;
|
||||
const CUSTOMS_TYPE_GOODS = 2;
|
||||
const CUSTOMS_TYPE_SAMPLE = 3;
|
||||
const CUSTOMS_TYPE_RETURN = 4;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
namespace Xentral\Modules\ShippingMethod\Model;
|
||||
|
||||
class Product
|
||||
{
|
||||
const SERVICE_COD = 'cod';
|
||||
const SERVICE_PREMIUM = 'premium';
|
||||
|
||||
public string $Id;
|
||||
public string $Name;
|
||||
public float $LengthMin = 0;
|
||||
public float $LengthMax = 500;
|
||||
public float $WidthMin = 0;
|
||||
public float $WidthMax = 500;
|
||||
public float $HeightMin = 0;
|
||||
public float $HeightMax = 500;
|
||||
public float $WeightMin = 0;
|
||||
public float $WeightMax = 100;
|
||||
public array $AvailableServices = [];
|
||||
|
||||
public static function Create(string $id, string $name):Product {
|
||||
$obj = new Product();
|
||||
$obj->Id = $id;
|
||||
$obj->Name = $name;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function WithLength(float $min, float $max): Product {
|
||||
$this->LengthMin = $min;
|
||||
$this->LengthMax = $max;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function WithWidth(float $min, float $max): Product {
|
||||
$this->WidthMin = $min;
|
||||
$this->WidthMax = $max;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function WithHeight(float $min, float $max): Product {
|
||||
$this->HeightMin = $min;
|
||||
$this->HeightMax = $max;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function WithWeight(float $min, float $max): Product {
|
||||
$this->WeightMin = $min;
|
||||
$this->WeightMax = $max;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function WithServices(array $services): Product {
|
||||
$this->AvailableServices = $services;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
var ShippingMethodCreate = function ($) {
|
||||
'use strict';
|
||||
|
||||
@@ -11,35 +18,14 @@ var ShippingMethodCreate = function ($) {
|
||||
vueElementId: '#shipment-create',
|
||||
},
|
||||
search: function (el) {
|
||||
$.ajax({
|
||||
url: 'index.php?module=versandarten&action=create&cmd=suche',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
val: $(el).val()
|
||||
}
|
||||
let val = $(el).val().toLowerCase();
|
||||
$('.createbutton').each(function() {
|
||||
let desc = $(this).find('.tilegrid-tile-title').text();
|
||||
if (desc.toLowerCase().indexOf(val)>=0)
|
||||
$(this).show();
|
||||
else
|
||||
$(this).hide();
|
||||
})
|
||||
.done(function (data) {
|
||||
if (typeof data != 'undefined' && data != null) {
|
||||
if (typeof data.ausblenden != 'undefined' && data.ausblenden != null) {
|
||||
me.storage.hideElements = data.ausblenden.split(';');
|
||||
$.each(me.storage.hideElements, function (k, v) {
|
||||
if (v != '') {
|
||||
$('#' + v).hide();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
if (typeof data.anzeigen != 'undefined' && data.anzeigen != null) {
|
||||
me.storage.showElements = data.anzeigen.split(';');
|
||||
$.each(me.storage.showElements, function (k, v) {
|
||||
if (v != '') {
|
||||
$('#' + v).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
init: function () {
|
||||
if ($(me.selector.vueElementId).length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user