mirror of
https://github.com/Karaka-Management/oms-ClientManagement.git
synced 2026-01-22 20:58:40 +00:00
fix demoSetup
This commit is contained in:
parent
3afb200021
commit
b50b81bf6c
|
|
@ -1,10 +1,8 @@
|
|||
import { Autoloader } from '../../jsOMS/Autoloader.js';
|
||||
import { NotificationMessage } from '../../jsOMS/Message/Notification/NotificationMessage.js';
|
||||
import { NotificationType } from '../../jsOMS/Message/Notification/NotificationType.js';
|
||||
|
||||
Autoloader.defineNamespace('jsOMS.Modules');
|
||||
|
||||
jsOMS.Modules.ClientManager = class {
|
||||
jsOMS.Modules.ClientManagement = class {
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
|
|
@ -17,24 +15,31 @@ jsOMS.Modules.ClientManager = class {
|
|||
|
||||
bind (id)
|
||||
{
|
||||
const e = typeof id === 'undefined' ? document.getElementsByTagName('canvas') : [document.getElementById(id)],
|
||||
length = e.length;
|
||||
const charts = typeof id === 'undefined' ? document.getElementsByTagName('canvas') : [document.getElementById(id)];
|
||||
let length = charts.length;
|
||||
|
||||
for (let i = 0; i < length; ++i) {
|
||||
if (e[i].getAttribute('data-chart') === null
|
||||
&& e[i].getAttribute('data-chart') !== 'undefined'
|
||||
if (charts[i].getAttribute('data-chart') === null
|
||||
&& charts[i].getAttribute('data-chart') !== 'undefined'
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.bindElement(e[i]);
|
||||
this.bindChart(charts[i]);
|
||||
}
|
||||
|
||||
const maps = typeof id === 'undefined' ? document.getElementsByClassName('map') : [document.getElementById(id)];
|
||||
length = maps.length;
|
||||
|
||||
for (let i = 0; i < length; ++i) {
|
||||
this.bindMap(maps[i]);
|
||||
}
|
||||
};
|
||||
|
||||
bindElement (chart)
|
||||
bindChart (chart)
|
||||
{
|
||||
if (typeof chart === 'undefined' || !chart) {
|
||||
jsOMS.Log.Logger.instance.error('Invalid chart: ' + chart, 'ClientManagementController');
|
||||
jsOMS.Log.Logger.instance.error('Invalid chart: ' + chart, 'ClientManagement');
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -44,6 +49,39 @@ jsOMS.Modules.ClientManager = class {
|
|||
|
||||
const myChart = new Chart(chart.getContext('2d'), data);
|
||||
};
|
||||
|
||||
bindMap (map)
|
||||
{
|
||||
if (typeof map === 'undefined' || !map) {
|
||||
jsOMS.Log.Logger.instance.error('Invalid map: ' + map, 'ClientManager');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const self = this;
|
||||
|
||||
map = new OpenLayers.Map(map.getAttribute('id'), {
|
||||
controls: [
|
||||
new OpenLayers.Control.Navigation(
|
||||
{
|
||||
zoomBoxEnabled: true,
|
||||
zoomWheelEnabled: false
|
||||
}
|
||||
),
|
||||
new OpenLayers.Control.Zoom(),
|
||||
new OpenLayers.Control.Attribution()
|
||||
]
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
map.addLayer(mapnik);
|
||||
map.setCenter(position, zoom );
|
||||
};
|
||||
};
|
||||
|
||||
window.omsApp.moduleManager.get('ClientManager').bind();
|
||||
window.omsApp.moduleManager.get('ClientManagement').bind();
|
||||
|
|
|
|||
|
|
@ -200,6 +200,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, 'Modules/ClientManagement/Controller.js', ['type' => 'module']);
|
||||
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
|
|
|||
|
|
@ -108,11 +108,11 @@ echo $this->getData('nav')->render(); ?>
|
|||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_client'); ?>" width="30" loading="lazy" class="item-image"
|
||||
src="<?= $image instanceof NullMedia ?
|
||||
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') :
|
||||
UriFactory::build('{/base}/' . $image->getPath()); ?>"></a>
|
||||
src="<?= $image instanceof NullMedia
|
||||
? '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->profile->account->name1); ?> <?= $this->printHtml($value->profile->account->name2); ?></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>
|
||||
<td data-label="<?= $this->getHtml('Zip'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->postal); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Address'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->address); ?></a>
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ $items = $this->getData('items') ?? [];
|
|||
</label>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->itemNumber); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->itemName); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->quantity); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->getQuantity()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->singleSalesPriceNet->getCurrency()); ?></a>
|
||||
<td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,15 @@ echo $this->getData('nav')->render();
|
|||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-3 last-lg">
|
||||
<div class="box">
|
||||
<?php if(true) : ?>
|
||||
<a class="button" href="<?= UriFactory::build('{/base}/sales/bill/create?client=' . $client->getId()); ?>"><?= $this->getHtml('CreateBill', 'Billing'); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php if (false) : ?>
|
||||
<a class="button"><?= $this->getHtml('ViewAccount', 'Accounting'); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<section class="portlet">
|
||||
<form>
|
||||
<div class="portlet-body">
|
||||
|
|
@ -95,7 +104,7 @@ echo $this->getData('nav')->render();
|
|||
</div>
|
||||
</section>
|
||||
|
||||
<section class="portlet">
|
||||
<section class="portlet map-small">
|
||||
<div class="portlet-head">
|
||||
<?= $this->getHtml('Address'); ?>
|
||||
<span class="clickPopup floatRight">
|
||||
|
|
@ -133,14 +142,11 @@ 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 endforeach; ?>
|
||||
</select>
|
||||
<tr><td>
|
||||
<?php if (\is_file(__DIR__ . '/../../../../phpOMS/Localization/Maps/svg/' . \strtolower($client->mainAddress->getCountry()) . '.svg')) : ?>
|
||||
<img alt="<?= $this->getHtml('IMG_alt_map'); ?>" id="iMap" style="width: 100%;" src="<?= UriFactory::build('phpOMS/Localization/Maps/svg/' . \strtolower($client->mainAddress->getCountry()) . '.svg'); ?>">
|
||||
<?php endif; ?>
|
||||
<?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>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user