Skip to content

Commit 707933d

Browse files
committed
1st commit, translating UI to react+redux
0 parents  commit 707933d

File tree

102 files changed

+32563
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+32563
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.yml]
15+
indent_style = space
16+
indent_size = 2

.env.example

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
9+
DB_CONNECTION=mysql
10+
DB_HOST=127.0.0.1
11+
DB_PORT=3306
12+
DB_DATABASE=homestead
13+
DB_USERNAME=homestead
14+
DB_PASSWORD=secret
15+
16+
BROADCAST_DRIVER=log
17+
CACHE_DRIVER=file
18+
SESSION_DRIVER=file
19+
SESSION_LIFETIME=120
20+
QUEUE_DRIVER=sync
21+
22+
REDIS_HOST=127.0.0.1
23+
REDIS_PASSWORD=null
24+
REDIS_PORT=6379
25+
26+
MAIL_DRIVER=smtp
27+
MAIL_HOST=smtp.mailtrap.io
28+
MAIL_PORT=2525
29+
MAIL_USERNAME=null
30+
MAIL_PASSWORD=null
31+
MAIL_ENCRYPTION=null
32+
33+
PUSHER_APP_ID=
34+
PUSHER_APP_KEY=
35+
PUSHER_APP_SECRET=
36+
PUSHER_APP_CLUSTER=mt1
37+
38+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
39+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
*.js linguist-vendored
5+
CHANGELOG.md export-ignore

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
/.idea
7+
/.vscode
8+
/.vagrant
9+
Homestead.json
10+
Homestead.yaml
11+
npm-debug.log
12+
yarn-error.log
13+
.env
14+
/public/js/*
15+
/public/css/*
16+
/public/mix-manifest.json

app/CLAgg/CLAggException.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace App\CLAgg;
4+
5+
use \Exception;
6+
7+
class CLAggException extends Exception {}

app/CLAgg/ReadConfig.php

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
<?php
2+
3+
namespace App\CLAgg;
4+
5+
class ReadConfig
6+
{
7+
private $_cl_info = null;
8+
9+
/**
10+
* @var SimpleXMLElement
11+
*/
12+
private $_xml = null;
13+
private $_locations = array();
14+
private $_areas = array();
15+
private $_regions = array();
16+
private $_fields = null;
17+
private $_fields_array = null;
18+
19+
/**
20+
* ReadConfig constructor.
21+
* @param null $fileLocation
22+
* @throws CLAggException
23+
*/
24+
function __construct($fileLocation = null)
25+
{
26+
if(is_null($fileLocation))
27+
throw new CLAggException('Must Enter your XML Configuration file.');
28+
29+
if(!file_exists($fileLocation))
30+
throw new CLAggException('Your XML Configuration must exist');
31+
32+
if(is_bool(strpos(strtolower($fileLocation),'.xml')))
33+
throw new CLAggException('File must have .xml extention');
34+
35+
$xmlstr = file_get_contents($fileLocation);
36+
$this->_xml = simplexml_load_string($xmlstr, 'SimpleXMLElement', LIBXML_NOCDATA);
37+
38+
$this->init();
39+
}
40+
41+
private function init()
42+
{
43+
$this->_build_areas();
44+
$this->_build_regions();
45+
}
46+
47+
public function getInfo()
48+
{
49+
if(is_null($this->_cl_info))
50+
{
51+
$this->_cl_info = $this->_xml->xpath('/clrepo/info');
52+
}
53+
return $this->_cl_info[0];
54+
}
55+
56+
public function getFields()
57+
{
58+
if($this->_fields != null)
59+
return $this->_fields;
60+
61+
$fields = $this->_xml->xpath('/clrepo/info/fields/argField');
62+
$this->_fields = array();
63+
foreach($fields as $field)
64+
{
65+
$this->_fields[] = get_object_vars($field);
66+
}
67+
68+
return $this->_fields;
69+
}
70+
71+
public function getFieldsArray()
72+
{
73+
if($this->_fields_array != null)
74+
return $this->_fields_array;
75+
76+
$this->_fields_array = array_map(function($array)
77+
{
78+
if(in_array($array['argType'], array('string','int')))
79+
{
80+
$array['argType'] = 'text';
81+
}
82+
elseif($array['argType'] == 'radio')
83+
{
84+
$argList = explode(':', $array['argTitle']);
85+
$titles = explode('|', $argList[0]);
86+
$args = explode('|', $argList[1]);
87+
$select = explode('|', $argList[2]);
88+
89+
$array['radios'] = array();
90+
91+
unset($array['argId']);
92+
unset($array['argKey']);
93+
unset($array['argTitle']);
94+
95+
for($i = 0; $i < count($titles); $i++)
96+
{
97+
$array['radios'][] = array(
98+
'checked' =>($select[$i] == '1'),
99+
'arg_name' =>$titles[$i],
100+
'arg_name_id' =>str_replace(' ', '_', $titles[$i]),
101+
'arg' =>$args[$i]
102+
);
103+
}
104+
105+
}
106+
elseif($array['argType'] == 'checkbox')
107+
{
108+
list($title, $value) = explode(':', $array['argTitle']);
109+
$arg_name = str_replace(' ', '_', $array['argName']);
110+
111+
unset($array['argId']);
112+
unset($array['argKey']);
113+
unset($array['argName']);
114+
unset($array['argTitle']);
115+
116+
$array['checkbox'] = array(
117+
'value' =>$value,
118+
'title' =>$title,
119+
'arg_name' =>$arg_name
120+
);
121+
}
122+
return $array;
123+
}, $this->getFields());
124+
125+
return $this->_fields_array;
126+
}
127+
128+
private function _build_areas()
129+
{
130+
$locations = array();
131+
foreach($this->_xml->xpath('/clrepo/locations/location') as $location)
132+
{
133+
$locations[] = get_object_vars($location);
134+
}
135+
136+
uasort($locations, function($a, $b)
137+
{
138+
if ($a['state'] == $b['state'])
139+
return $a['name'] > $b['name']?1:-1;
140+
else
141+
return $a['state'] > $b['state']?1:-1;
142+
});
143+
144+
foreach($locations as $location)
145+
{
146+
$this->_locations[] = $location;
147+
$this->_areas[$location['state']][] = array(
148+
'type' =>$location['type'],
149+
'partial' =>$location['partial'],
150+
'name' =>ucwords($location['name']),
151+
'state' =>$location['state']
152+
);
153+
}
154+
ksort($this->_areas);
155+
}
156+
157+
private function _build_regions()
158+
{
159+
$regions = array();
160+
foreach($this->_xml->xpath('/clrepo/regions/region') as $region)
161+
{
162+
$regions[] = get_object_vars($region);
163+
}
164+
165+
uasort($regions, function($a,$b)
166+
{
167+
return $a['name'] > $b['name']?1:-1;
168+
});
169+
170+
foreach($regions as $region)
171+
{
172+
$this->_regions[] = array(
173+
'type'=>$region['type'],
174+
'name'=>ucwords($region['name']),
175+
);
176+
}
177+
}
178+
179+
public function getAreas()
180+
{
181+
return $this->_areas;
182+
}
183+
184+
public function getLocations()
185+
{
186+
return $this->_locations;
187+
}
188+
189+
public function getRegions()
190+
{
191+
return $this->_regions;
192+
}
193+
194+
}

0 commit comments

Comments
 (0)