Coop stuff
Total: {{ccidlist.length}} Search: {{filtered.length}}
{{stat.name}}
{{stat.street}}
{{stat.postal}}
{{stat.city}}
let aalert=function(msg){ let a=document.createElement('div') a.innerHTML=msg document.getElementById('ccidlog').append(a); }
var app = angular.module('myApp', []); app.controller('myCtrl', function($scope, $http, $filter) { window.$scope=$scope;
$scope.ccidlist=[]
$scope.selectStore=function (selected){ $scope.selected=selected; alert(selected.ccid + " selected - redirect to order page here..." ); }
const filename='edi_gln_overview_utf8.csv';
aalert('loading file')
fetch(filename)
.then(response => response.text())
.then((data) => {
let lines=data.split('\n');
// lines.shift()
// lines.shift()
let ccidlist=[]
lines.forEach(line => {
//aalert(line+'
')
let ccdata=line.split(';')
let ccid={
ccid:ccdata[0],
name:ccdata[3],
street:ccdata[4],
postal:ccdata[5],
city:ccdata[6],
country:ccdata[7]
}
if(ccid.ccid && ccid.ccid.startsWith("CC")){
ccidlist.push(ccid);
$scope.ccidlist.push(ccid);
aalert(ccid.ccid + ' ' + ccid.name + ' ' + ccid.street + ' ' + ccid.postal + ' ' + ccid.city + ' ' + ccid.country)
}
})
$scope.$apply(); //fetch is async and not triggering angular
})
// $scope.sss = $filter('myFilter')($scope.ccidlist);
});