This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const menuItem = (obj, depth) => { | |
let line = ""; | |
for (let i = 0; i < depth; i++) { | |
line += " — "; | |
} | |
return ( | |
<MenuItem value={obj.id} onChange={handleMultiple}> | |
{line} {obj.name} | |
</MenuItem> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createDataTree = (dataset) => { // dataset - parentID ve id içeren objelerle dolu | |
const storehousesAsTree = []; // apinin geri döneceği array | |
let depth = 0; // başlangıç ağaç derinliğimiz | |
for (let i = 0; i < dataset.length; i += 1) { // bu döngünün amacı birden fazla root olma durumu içindir. Farklı ağaçlar oluşturmaktadır. | |
if (dataset[i].parentID === 0) { // Parent ID'si default 0 olanın parentı yok demektir ve Root kategoridir. | |
const parentID = dataset[i].id; | |
const tree = new Tree(); // Bulduğumuz elemanın root olduğu Treemizi oluşturuyoruz. | |
tree.add(dataset[i]); // add metodu tek parametre alırsa eklenen eleman root demektir. | |
const filteredDataSet = dataset.filter((el) => el.id !== parentID); // Bu filtreleme işlemi datasetten, ağaca eklediğimiz elemanı çıkarmak için | |
depth = findChilds(filteredDataSet, parentID, tree, 1); // ağacın rootunu yardımcı metodumuza gönderiyoruz ve o recursive olarak çocuklarını buluyor. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"storehousesAsTree": [ | |
{ | |
"root": { | |
"id": 1, | |
"name": "Fabrika Depo", | |
"children": [ | |
{ | |
"id": 2, | |
"name": "Ankara Depo", | |
"children": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Node(data) { | |
this.id = data.id; | |
this.name = data.name; | |
this.children = []; | |
} | |
class Tree { | |
constructor() { | |
this.root = null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const StorehouseSchema = new Schema( | |
{ | |
id: { | |
type: Number, | |
unique: true, | |
}, | |
parentID: { | |
type: String, | |
required: false, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const soap = require("soap"); | |
const url = | |
"http://customerservices.araskargo.com.tr/ArasCargoCustomerIntegrationService/ArasCargoIntegrationService.svc?wsdl"; | |
//Esasweb uzerinden alinan bilgiler | |
const loginInfo = | |
"<LoginInfo>" + | |
"<UserName>samilkahraman</UserName>" + | |
"<Password>sifre</Password>" + | |
"<CustomerCode>123456789musterino</CustomerCode>" + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function AuthExample() { | |
return ( | |
<Router> | |
<div> | |
<AuthButton /> | |
<ul> | |
<li> | |
<Link to="/public">Public Page</Link> | |
</li> |