Skip to content

Commit

Permalink
cool table!
Browse files Browse the repository at this point in the history
  • Loading branch information
simon committed May 3, 2022
1 parent 73d7324 commit b94616f
Show file tree
Hide file tree
Showing 17 changed files with 9,373 additions and 16,284 deletions.
2 changes: 1 addition & 1 deletion dfc-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10-alpine
FROM node:14-alpine

WORKDIR /home/node/app

Expand Down
24,224 changes: 8,563 additions & 15,661 deletions dfc-ui/package-lock.json

Large diffs are not rendered by default.

24 changes: 8 additions & 16 deletions dfc-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "webpack-dev-server --config webpack.dev.js",
"start": "http-server ./dist/ui -p 8090 -g",
"prestart": "npm run build",
"build": "webpack --config webpack.prod.js"
"build": "webpack --config webpack.prod.js",
"version": "webpack --version"
},
"author": "",
"license": "AGPLV3",
Expand All @@ -22,40 +23,31 @@
"css-loader": "^3.6.0",
"file-loader": "^6.0.0",
"html-loader": "^1.1.0",
"html-webpack-plugin": "^4.3.0",
"html-webpack-plugin": "^5.5.0",
"http-server": "^0.12.3",
"image-webpack-loader": "^6.0.0",
"mkdirp": "^1.0.4",
"qs": "^6.9.4",
"rimraf": "^3.0.2",
"style-loader": "^1.2.1",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack": "^5.72.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.8.1",
"webpack-merge": "^5.0.9",
"webpack-visualizer-plugin": "^0.1.11"
"webpack-visualizer-plugin2": "^1.0.0"
},
"dependencies": {
"@babel/polyfill": "^7.10.4",
"@ldflex/comunica": "^3.4.0",
"@rdfjs/data-model": "^1.1.2",
"@webcomponents/webcomponentsjs": "^2.4.4",
"devextreme": "^21.2.6",
"express": "^4.17.1",
"express-session": "^1.17.1",
"install": "^0.13.0",
"jquery": "^3.5.1",
"jsonld": "^3.1.1",
"ldflex": "^2.11.1",
"mongodb": "^3.5.9",
"mongoose": "^5.9.25",
"navigo": "^7.1.2",
"node-fetch": "^2.6.0",
"node-jose": "^1.1.4",
"npm": "^6.14.7",
"openid-client": "^3.15.8",
"passport": "^0.4.1",
"postal": "^2.0.5",
"request": "^2.88.2",
"sift": "^13.2.0"
}
}
152 changes: 57 additions & 95 deletions dfc-ui/src/ui/component/catalogImport/model.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import GenericElement from '../../core/genericElement.js';
import view from 'html-loader!./view.html';
import easyui from '../../easyui/jquery-easyui-1.8.1/jquery.easyui.min.js';
import easyuiCss from '../../easyui/jquery-easyui-1.8.1/themes/default/easyui.css';
import easyuiCssIcons from '../../easyui/jquery-easyui-1.8.1/themes/icon.css';
import easyuiCssColors from '../../easyui/jquery-easyui-1.8.1/themes/color.css';

import 'devextreme/integration/jquery';
import TreeList from "devextreme/ui/tree_list";
import dxcss from 'devextreme/dist/css/dx.light.css';

export default class CatalogImport extends GenericElement {
constructor() {
super(view);

this.dxGridDom = this.shadowRoot.querySelector('#dxGrid');

this.subscribe({
channel: 'import',
topic: 'changeAll',
Expand All @@ -19,93 +22,15 @@ export default class CatalogImport extends GenericElement {

connectedCallback() {
super.connectedCallback();
$(this.shadowRoot.querySelector("#panel")).panel({
fit: true
});
this.gridDom = $(this.shadowRoot.querySelector("#grid"));

let datagrid = this.gridDom.datagrid({
fit: true,
singleSelect:true,
autoLoad: false,
onSelect: (id,rowData) => {
this.selected = rowData.raw
},
columns: [
[{
field: 'description',
title: 'description',
width: 300,
sortable: true,
},
{
field: 'quantity',
title: 'quantity',
width: 100,
sortable: true
}, {
field: 'unit',
title: 'unit',
width: 100,
sortable: true
},
{
field: 'sku',
title: 'sku',
width: 100
},
{
field: 'stockLimitation',
title: 'stock limitation (catalog)',
width: 100
},
{
field: 'totalTheoriticalStock',
title: 'total theoritical stock (supply)',
width: 100
},
{
field: 'type',
title: 'type',
width: 100
},
{
field: 'source',
title: 'source',
width: 200,
sortable: true
},
// {
// field: 'action',
// title: 'Action',
// width: 80,
// align: 'center',
// formatter: function(value, row, index) {
// return '<a href="./#/x-item-import/' + encodeURIComponent(row['@id'] )+ '">Edit</a> ';
// }
// }
]
]
});

this.publish({
channel: 'import',
topic: 'loadAll'
});

this.gridDom.datagrid('getPanel').find('.datagrid-header .datagrid-htable').css('height', '');
this.gridDom.datagrid('getPanel').find('.datagrid-header').css('height', '');
// this.gridDom.datagrid('resize');

let injectedStyle = document.createElement('style');
injectedStyle.appendChild(document.createTextNode(easyuiCss.toString()));
this.shadowRoot.appendChild(injectedStyle);
let injectedStyle2 = document.createElement('style');
injectedStyle2.appendChild(document.createTextNode(easyuiCssIcons.toString()));
this.shadowRoot.appendChild(injectedStyle2);
let injectedStyle3 = document.createElement('style');
injectedStyle3.appendChild(document.createTextNode(easyuiCssColors.toString()));
this.shadowRoot.appendChild(injectedStyle3);
let injectedStyle4 = document.createElement('style');
injectedStyle4.appendChild(document.createTextNode(dxcss.toString()));
this.shadowRoot.appendChild(injectedStyle4);

this.shadowRoot.querySelector('#edit').addEventListener('click', e => {
this.edit();
Expand All @@ -131,25 +56,62 @@ export default class CatalogImport extends GenericElement {
setDataGrid(data) {
// let catalogList =this.shadowRoot.getElementById('catalogList');
console.log('data received', data);

let counter = 0;
let dataEasyUi = data.map(d => {
const dxData = data.map(d => {
counter++;
return {
id: counter,
source: d['dfc-t:hostedBy']?d['dfc-t:hostedBy']['rdfs:label']:'',
description: d['dfc-b:references']['dfc-b:description'],
quantity: d['dfc-b:references']['dfc-b:quantity'],
sku: d['dfc-b:sku'],
stockLimitation : d['dfc-b:stockLimitation'],
totalTheoriticalStock : d['dfc-b:references']['dfc-b:totalTheoriticalStock'],
unit: d['dfc-b:references']['dfc-p:hasUnit']?d['dfc-b:references']['dfc-p:hasUnit']['rdfs:label']:'',
totalTheoriticalStock : d['dfc-b:references']['dfc-b:totalTheoriticalStock'],
type: d['dfc-b:references']['dfc-p:hasType']?d['dfc-b:references']['dfc-p:hasType']['rdfs:label']:'',
description: d['dfc-b:references']['dfc-b:description'],
quantity: d['dfc-b:references']['dfc-b:quantity'],
raw:d,
// unit: d['dfc:hasUnit']['@id'],
'@id': d['@id']
source: d['dfc-t:hostedBy']?d['dfc-t:hostedBy']['rdfs:label']:'',
raw :d
}
})
// console.log('dataEasyUi', dataEasyUi);
this.gridDom.datagrid('loadData', dataEasyUi);

this.dxGrid = new TreeList(this.dxGridDom, {
"autoExpandAll": true,
"columns": [
"description",
"quantity",
"unit",
"sku",
"stockLimitation",
"totalTheoriticalStock",
"type",
"source",
{
type: "buttons",
buttons: [{
// text: "Edit",
// cssClass: "button-dx",
// icon : "https://img.icons8.com/windows/32/000000/edit--v1.png",
template: function (element, data) {
// console.log('ALLO TEMPLATE',data, element);
const item = $(`<div class="button-dx"><image src="https://img.icons8.com/windows/32/000000/link--v1.png"/></div>`)
element.append(item);
// return "edit template"
},
onClick: (e)=>{
console.log(e);
this.publish({
channel: 'main',
topic: 'navigate',
data : '/x-item-import/'+encodeURIComponent(e.row.data.raw['@id'])
})
}
}]
}
],
"dataSource": dxData,
"showRowLines": true
});
// this.dxGrid.dataSource= dataEasyUi;
}
}
window.customElements.define('x-catalog-import', CatalogImport);
25 changes: 2 additions & 23 deletions dfc-ui/src/ui/component/catalogImport/view.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
<div class="panelContainer" style="flex:1">
<table style="height:100%;width:98%">
<tr style="height:30px">
<td>
<h1>Non-reconciled products</h1>
</td>
</tr>
<tr style="height:30px">
<td>
<div class="containerH space-between">
<h2>Edit a non-reconciled products</h2>
<div class="containerH">
<button id="edit">edit</button>
</div>
</div>
</td>
</tr>
<tr style="height:100%">
<td>
<div id="grid">
</div>
</td>
</tr>
</table>
<h1>Non-reconciled products</h1>
<div id="dxGrid"/>
</div>
<style>

Expand Down
Loading

0 comments on commit b94616f

Please sign in to comment.