mirror of
https://github.com/Karaka-Management/oms-ClientManagement.git
synced 2026-01-21 12:18:41 +00:00
bug fixes and item management improvements
This commit is contained in:
parent
3e5edd87a5
commit
00e6c42c80
|
|
@ -58,9 +58,7 @@ jsOMS.Modules.ClientManagement = class {
|
|||
return;
|
||||
}
|
||||
|
||||
const self = this;
|
||||
|
||||
map = new OpenLayers.Map(map.getAttribute('id'), {
|
||||
const mapObj = new OpenLayers.Map(map.getAttribute('id'), {
|
||||
controls: [
|
||||
new OpenLayers.Control.Navigation(
|
||||
{
|
||||
|
|
@ -73,14 +71,19 @@ jsOMS.Modules.ClientManagement = class {
|
|||
]
|
||||
});
|
||||
|
||||
var mapnik = new OpenLayers.Layer.OSM();
|
||||
var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984
|
||||
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
|
||||
var position = new OpenLayers.LonLat(13.41,52.52).transform( fromProjection, toProjection);
|
||||
var zoom = 15;
|
||||
mapObj.addLayer(new OpenLayers.Layer.OSM());
|
||||
|
||||
map.addLayer(mapnik);
|
||||
map.setCenter(position, zoom );
|
||||
const fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984
|
||||
const toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
|
||||
const position = new OpenLayers.LonLat(map.getAttribute('data-lon'), map.getAttribute('data-lat')).transform(fromProjection, toProjection);
|
||||
const zoom = 12;
|
||||
|
||||
const markers = new OpenLayers.Layer.Markers("Markers");
|
||||
mapObj.addLayer(markers);
|
||||
|
||||
markers.addMarker(new OpenLayers.Marker(position));
|
||||
|
||||
mapObj.setCenter(position, zoom);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ use Modules\Media\Models\MediaMapper;
|
|||
use Modules\Media\Models\PathSettings;
|
||||
use Modules\Organization\Models\UnitMapper;
|
||||
use phpOMS\Api\EUVAT\EUVATVies;
|
||||
use phpOMS\Api\Geocoding\Nominatim;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\BaseStringL11nType;
|
||||
use phpOMS\Localization\ISO3166CharEnum;
|
||||
|
|
@ -229,6 +230,15 @@ final class ApiController extends Controller
|
|||
$addr->city = $request->getDataString('city') ?? '';
|
||||
$addr->setCountry($request->getDataString('country') ?? ISO3166TwoEnum::_XXX);
|
||||
$addr->state = $request->getDataString('state') ?? '';
|
||||
|
||||
$geocoding = Nominatim::geocoding($addr->country, $addr->city, $addr->address);
|
||||
if ($geocoding === ['lat' => 0.0, 'lon' => 0.0]) {
|
||||
$geocoding = Nominatim::geocoding($addr->country, $addr->city);
|
||||
}
|
||||
|
||||
$addr->lat = $geocoding['lat'];
|
||||
$addr->lon = $geocoding['lon'];
|
||||
|
||||
$client->mainAddress = $addr;
|
||||
|
||||
$client->unit = $request->getDataInt('unit');
|
||||
|
|
|
|||
|
|
@ -158,12 +158,8 @@ final class BackendController extends Controller
|
|||
/** @var \Modules\ClientManagement\Models\Client $client */
|
||||
$client = ClientMapper::getAll()
|
||||
->with('account')
|
||||
->with('files')
|
||||
->with('files/type')
|
||||
->with('mainAddress')
|
||||
->where('files/type/name', 'client_profile_image')
|
||||
->limit(25)
|
||||
->limit(1, 'files/type')
|
||||
->execute();
|
||||
|
||||
$view->addData('client', $client);
|
||||
|
|
@ -209,7 +205,7 @@ final class BackendController extends Controller
|
|||
$head = $response->get('Content')->getData('head');
|
||||
$head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css');
|
||||
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js');
|
||||
$head->addAsset(AssetType::JSLATE, 'Resources/OpenLayers/OpenLayers.light.js');
|
||||
$head->addAsset(AssetType::JSLATE, 'Resources/OpenLayers/OpenLayers.js');
|
||||
$head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['type' => 'module']);
|
||||
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
|
|
|||
|
|
@ -33,20 +33,68 @@ use Modules\Profile\Models\Profile;
|
|||
*/
|
||||
class Client
|
||||
{
|
||||
/**
|
||||
* ID value.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $id = 0;
|
||||
|
||||
/**
|
||||
* Number value.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $number = '';
|
||||
|
||||
/**
|
||||
* Reversed number value.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $numberReverse = '';
|
||||
|
||||
/**
|
||||
* Status value.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $status = ClientStatus::ACTIVE;
|
||||
|
||||
/**
|
||||
* Type value.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $type = 0;
|
||||
|
||||
/**
|
||||
* Additional information.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $info = '';
|
||||
|
||||
/**
|
||||
* Creation date and time.
|
||||
*
|
||||
* @var \DateTimeImmutable
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public \DateTimeImmutable $createdAt;
|
||||
|
||||
/**
|
||||
* Account associated with the client.
|
||||
*
|
||||
* @var Account
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public Account $account;
|
||||
|
||||
/**
|
||||
|
|
@ -65,20 +113,68 @@ class Client
|
|||
*/
|
||||
private array $notes = [];
|
||||
|
||||
/**
|
||||
* Contact elements.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $contactElements = [];
|
||||
|
||||
/**
|
||||
* Main address.
|
||||
*
|
||||
* @var Address
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public Address $mainAddress;
|
||||
|
||||
/**
|
||||
* Address.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $address = [];
|
||||
|
||||
/**
|
||||
* Partners.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $partners = [];
|
||||
|
||||
/**
|
||||
* Sales representative.
|
||||
*
|
||||
* @var Profile|null
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ?Profile $salesRep = null;
|
||||
|
||||
/**
|
||||
* Advertisement material.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $advertisementMaterial = 0;
|
||||
|
||||
/**
|
||||
* Default delivery address.
|
||||
*
|
||||
* @var Address|null
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ?Address $defaultDeliveryAddress = null;
|
||||
|
||||
/**
|
||||
* Default invoice address.
|
||||
*
|
||||
* @var Address|null
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ?Address $defaultInvoiceAddress = null;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||
return ['ClientManagement' => [
|
||||
'AttributeTypes' => 'Attribute Types',
|
||||
'Accounting' => 'Accounting',
|
||||
'Map' => 'Map',
|
||||
'Addition' => 'Addition',
|
||||
'Address' => 'Address',
|
||||
'Addresses' => 'Addresses',
|
||||
|
|
|
|||
|
|
@ -12,8 +12,11 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Attribute\Models\AttributeValueType;
|
||||
use phpOMS\Localization\ISO639Enum;
|
||||
|
||||
$types = AttributeValueType::getConstants();
|
||||
|
||||
$attribute = $this->getData('attribute');
|
||||
$l11ns = $this->getData('l11ns');
|
||||
|
||||
|
|
@ -22,17 +25,47 @@ echo $this->getData('nav')->render(); ?>
|
|||
<div class="row">
|
||||
<div class="col-md-6 col-xs-12">
|
||||
<section id="task" class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Attribute'); ?></div>
|
||||
<div class="portlet-head"><?= $this->getHtml('Attribute', 'Attribute', 'Backend'); ?></div>
|
||||
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID'); ?></label>
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<input type="text" value="<?= $this->printHtml((string) $attribute->id); ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName"><?= $this->getHtml('Name'); ?></label>
|
||||
<input type="text" value="<?= $this->printHtml($attribute->name); ?>" disabled>
|
||||
<label for="iName"><?= $this->getHtml('Name', 'Attribute', 'Backend'); ?></label>
|
||||
<input id="iNAme" type="text" value="<?= $this->printHtml($attribute->name); ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iType"><?= $this->getHtml('Datatype', 'Attribute', 'Backend'); ?></label>
|
||||
<select id="iType" name="type" disabled>
|
||||
<?php foreach ($types as $key => $type) : ?>
|
||||
<option value="<?= $type; ?>"<?= $type === $attribute->datatype ? ' selected' : ''; ?>><?= $this->printHtml($key); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iPattern"><?= $this->getHtml('Pattern', 'Attribute', 'Backend'); ?></label>
|
||||
<input id="iPattern" type="text" value="<?= $this->printHtml($attribute->validationPAttern); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="checkbox" for="iRequired">
|
||||
<input id="iRequired" type="checkbox" name="required" value="1"<?= $attribute->isRequired ? ' checked' : ''; ?>>
|
||||
<span class="checkmark"></span>
|
||||
<?= $this->getHtml('IsRequired', 'Attribute', 'Backend'); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="checkbox" for="iCustom">
|
||||
<input id="iCustom" type="checkbox" name="custom" value="1" <?= $attribute->custom ? ' checked' : ''; ?>>
|
||||
<span class="checkmark"></span>
|
||||
<?= $this->getHtml('CustomValue', 'Attribute', 'Backend'); ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -47,7 +80,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<td>
|
||||
<td>
|
||||
<td><?= $this->getHtml('Language', '0', '0'); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('Title'); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('Title', 'Attribute', 'Backend'); ?>
|
||||
<tbody>
|
||||
<?php $c = 0; foreach ($l11ns as $key => $value) : ++$c; ?>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ echo $this->getData('nav')->render(); ?>
|
|||
<table id="iSalesClientList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>
|
||||
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||
<label for="iSalesClientList-sort-1">
|
||||
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-1">
|
||||
|
|
@ -107,10 +106,6 @@ echo $this->getData('nav')->render(); ?>
|
|||
$image = $value->getFileByTypeName('client_profile_image');
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_client'); ?>" width="30" loading="lazy" class="item-image"
|
||||
src="<?= $image->id === 0
|
||||
? 'Web/Backend/img/logo_grey.png'
|
||||
: UriFactory::build('{/base}/' . $image->getPath()); ?>"></a>
|
||||
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->number); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->account->name1); ?> <?= $this->printHtml($value->account->name2); ?></a>
|
||||
<td data-label="<?= $this->getHtml('City'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->city); ?></a>
|
||||
|
|
|
|||
|
|
@ -145,15 +145,25 @@ echo $this->getData('nav')->render();
|
|||
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($client->mainAddress->city); ?>" required>
|
||||
<tr><td><label for="iName1"><?= $this->getHtml('Country'); ?></label>
|
||||
<tr><td><select name="country">
|
||||
<?php foreach ($countryCodes as $code3 => $code2) : ?>
|
||||
<option value="<?= $this->printHtml($code2); ?>"<?= $this->printHtml($code2 === $client->mainAddress->getCountry() ? ' selected' : ''); ?>><?= $this->printHtml($countries[$code3]); ?>
|
||||
<?php foreach ($countryCodes as $code3 => $code2) : ?>
|
||||
<option value="<?= $this->printHtml($code2); ?>"<?= $this->printHtml($code2 === $client->mainAddress->getCountry() ? ' selected' : ''); ?>><?= $this->printHtml($countries[$code3]); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<tr><td><div id="clientMap" class="map"></div>
|
||||
<tr><td><label for="iName1"><?= $this->getHtml('Map'); ?></label>
|
||||
<tr><td><div id="clientMap" class="map" data-lat="<?= $client->mainAddress->lat; ?>" data-lon="<?= $client->mainAddress->lon; ?>"></div>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="portlet">
|
||||
<div class="portlet-body">
|
||||
<img alt="<?= $this->printHtml($clientImage->name); ?>" width="100%" loading="lazy" class="item-image"
|
||||
src="<?= $clientImage->id === 0
|
||||
? 'Web/Backend/img/logo_grey.png'
|
||||
: UriFactory::build($clientImage->getPath()); ?>">
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="portlet highlight-4">
|
||||
<div class="portlet-body">
|
||||
<textarea class="undecorated"><?= $this->printHtml($client->info); ?></textarea>
|
||||
|
|
@ -284,7 +294,7 @@ echo $this->getData('nav')->render();
|
|||
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->type->getL11n(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->billTo; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->netSales->getCurrency(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->createdAt->format('Y-m-d'); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
|
@ -329,7 +339,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<?= \implode(',', $temp); ?>
|
||||
],
|
||||
"yAxisID": "axis-2",
|
||||
"yAxisID": "axis2",
|
||||
"fill": false,
|
||||
"borderColor": "rgb(255, 99, 132)",
|
||||
"backgroundColor": "rgb(255, 99, 132)"
|
||||
|
|
@ -341,43 +351,42 @@ echo $this->getData('nav')->render();
|
|||
<?php
|
||||
$temp = [];
|
||||
foreach ($monthlySalesCosts as $monthly) {
|
||||
$temp[] = ((int) $monthly['net_sales']) / 1000;
|
||||
$temp[] = (float) (((int) $monthly['net_sales']) / 1000);
|
||||
}
|
||||
?>
|
||||
<?= \implode(',', $temp); ?>
|
||||
],
|
||||
"yAxisID": "axis-1",
|
||||
"yAxisID": "axis1",
|
||||
"backgroundColor": "rgb(54, 162, 235)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"responsive": true,
|
||||
"scales": {
|
||||
"yAxes": [
|
||||
{
|
||||
"id": "axis-1",
|
||||
"axis1": {
|
||||
"id": "axis1",
|
||||
"display": true,
|
||||
"position": "left"
|
||||
},
|
||||
"axis2": {
|
||||
"id": "axis2",
|
||||
"display": true,
|
||||
"position": "right",
|
||||
"title": {
|
||||
"display": true,
|
||||
"position": "left"
|
||||
"text": "<?= $this->getHtml('Margin'); ?> %"
|
||||
},
|
||||
{
|
||||
"id": "axis-2",
|
||||
"display": true,
|
||||
"position": "right",
|
||||
"scaleLabel": {
|
||||
"display": true,
|
||||
"labelString": "<?= $this->getHtml('Margin'); ?> %"
|
||||
},
|
||||
"gridLines": {
|
||||
"display": false
|
||||
},
|
||||
"beginAtZero": true,
|
||||
"ticks": {
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"stepSize": 10
|
||||
}
|
||||
"grid": {
|
||||
"display": false
|
||||
},
|
||||
"beginAtZero": true,
|
||||
"ticks": {
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"stepSize": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}'></canvas>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user