text
stringlengths 7
3.69M
|
|---|
console.log('hello world!!');
console.log('Hey babe!fd!!');
|
import React, { Component } from "react";
import * as constant from "../../constant/constant";
import Header from '../../component/header/';
import CardItem from '../../component/cardItem';
export default class Home extends Component {
constructor(props) {
super(props);
}
componentDidMount() {}
render() {
const {history, list, votePostUp, votePostDown} = this.props;
let dataList = list.slice(0, 20);
return (
<div className="container">
<div
className="home"
style={{
paddingTop: constant.mainHeaderHeight,
paddingBottom: constant.mainFooterHeight
}}
>
<Header
history={history}
/>
{ dataList && dataList.length > 0 && dataList.map((item, index) => (
<CardItem
item={item}
votePostUp={votePostUp}
votePostDown={votePostDown}
key={index}
/>
))}
</div>
</div>
);
}
}
|
var mqtt = require('mqtt')
exports.publish = (req, res) => {
var data = req.body
data = JSON.stringify(data)
var client = mqtt.connect('mqtt://demo.thingsboard.io',{
username: "WZmujYnJH0hIIWex7zlS"
})
client.on('connect', function () {
client.publish('v1/devices/me/telemetry', data)
client.end()
})
res.send("Publish data success!!")
}
|
class Coins {
constructor() {
this.x = Math.floor(Math.random() * 450);
this.y = 100;
this.canvas = document.getElementById('my-canvas');
this.ctx = this.canvas.getContext('2d');
this.width = 60;
this.height = 60;
this.status = true;
this.img = new Image(this.width, this.height);
this.img.src = 'images/Coins.png';
this.speech = 15
}
draw() {
this.ctx.drawImage(this.img, this.x, this.y, this.width, this.height);
}
moveDown() {
this.y += this.speech;
}
}
|
const AccesoProhibidoException = use('App/Exceptions/AccesoProhibidoException');
const RecurosNoEncontradoException =use('App/Exceptions/RecurosNoEncontradoException');
class AutorizacionService{
verificarPermiso(recurso, user){
if(!recurso){
throw new RecurosNoEncontradoException();
}
if(recurso.user_id !== user.id){
throw new AccesoProhibidoException();
}
}
}
module.exports = new AutorizacionService();
|
'use strict';
const fs = require('fs');
fs.readFile('config.json', (err, data) => {
if (err) throw err;
let serverid1 = JSON.parse(data).serverID;
let clid1 = JSON.parse(data).clientID;
let details1 = JSON.parse(data).details;
let largeImage1 = JSON.parse(data).largeImageName;
let largeImageText1 = JSON.parse(data).largeImageText;
let smallImage1 = JSON.parse(data).smallImageName;
let ainvite = JSON.parse(data).create_invite_auto;
let smallImageText = JSON.parse(data).smallImageText;
const node_fetch = require("node-fetch");
node_fetch(`https://discordapp.com/api/guilds/${serverid1}/widget.json`).then(res => res.text()).then(data => {console.log(JSON.parse(data).message);
if (JSON.parse(data).message == "Widget Disabled") {
console.log("Widget in this server Disabled turn on widget in server settings");
}
node_fetch(`https://discordapp.com/api/guilds/${serverid1}/widget.json`).then(res => res.text()).then(data => {console.log(JSON.parse(data).name);
node_fetch(`https://discordapp.com/api/guilds/${serverid1}/widget.json`).then(res => res.text()).then(data => {console.log(JSON.parse(data).presence_count);
node_fetch(`https://discordapp.com/api/guilds/${serverid1}/widget.json`).then(res => res.text()).then(data => {console.log(JSON.parse(data).instant_invite);
let auto_link = JSON.parse(data).instant_invite;
console.log("auto create invite:",ainvite);
if (ainvite == "off") {
auto_link = smallImageText;
}
'use strict';
const client = require('.')(`${clid1}`);
client.on('join', (secret) => {
console.log('we should join with', secret);
});
client.on('spectate', (secret) => {
console.log('we should spectate with', secret);
});
client.on('joinRequest', (user) => {
if (user.discriminator === '1337') {
client.reply(user, 'YES');
} else {
client.reply(user, 'IGNORE');
}
});
client.on('connected', () => {
console.log('connected!');
let numbermem = JSON.parse(data).presence_count
client.updatePresence({
state: 'Online Members',
details: `${details1}`,
largeImageKey: `${largeImage1}`,
largeImageText: `${largeImageText1}`,
smallImageKey: `${smallImage1}`,
smallImageText: `${auto_link}`,
partyId: 'snek_party',
partySize: 1,
partyMax: JSON.parse(data).presence_count,
matchSecret: 'slithers',
joinSecret: 'boop',
spectateSecret: 'sniff',
});
});
process.on('unhandledRejection', console.error);
})
})
})
})
});
|
angular.module('devmtnTravel').controller('packagesCtrl',function($scope,mainSrv){
$scope.packages = mainSrv.travelInfo;
})
|
$(document).ready(function () {
"use strict";
var empty = [];
var permarray = [0, 3, 7, 6, 1, 4, 9, 2, 5, 8];
var countup = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
empty.length = 10;
var av = new JSAV("collisionCON3");
// Create an array object under control of JSAV library
var arr = av.ds.array(empty, {indexed: true});
var perm = av.ds.array(permarray, {indexed: true, visible: false});
av.umsg("Let's see an example of collision resolution using pseudorandom probing on a hash table of size 10 using the simple mod hash function.");
av.displayInit();
av.umsg("We need to first define a random permutation of the values 1 to M-1 that all inserts and searches will use. This is shown in the <code>permuation</code> array, so that you can see it during the whole slideshow.");
perm.show();
av.label("Permutation:", {before: perm, top: 70});
av.step();
av.umsg("Insert a record with key value 157.");
arr.highlight(7);
arr.value(7, 157);
av.step();
av.umsg("Insert a record with key value 273.");
arr.unhighlight(7);
arr.highlight(3);
arr.value(3, 273);
av.step();
av.umsg("Insert a record with key value 17. Unfortunately there is already a value in slot 7.");
arr.unhighlight(3);
arr.highlight(7);
av.step();
av.umsg("So now we look in the permuation array for the value at position perm[1], and add that value to the home slot index (which is 7), to get a value of 10 % 10, which is slot 0.");
arr.unhighlight(7);
arr.highlight(0);
arr.value(0, 17);
av.step();
av.umsg("Insert a record with key value 913. Unfortunately there is already a value in slot 3.");
arr.unhighlight(0);
arr.highlight(3);
av.step();
av.umsg("So now we look in the permuation array for the value at position perm[1], and add that value to the home slot index (which is 3), to get a value of 6.");
arr.unhighlight(3);
arr.highlight(6);
arr.value(6, 913);
av.step();
av.umsg("Insert a record with key value 110. Unfortunately there is already a value in slot 0.");
arr.unhighlight(6);
arr.highlight(0);
av.step();
av.umsg("So now we look in the permuation array for the value at position perm[1], and add that value to the home slot index (which is 0), to get a value of 3. Unfortunately, slot 3 is full as well!");
arr.unhighlight(0);
arr.highlight(3);
av.step();
av.umsg("So now we look in the permuation array for the value at position perm[2], and add that value to the home slot index (which is 0), to get a value of 7. Unfortunately, slot 7 is full as well!");
arr.unhighlight(3);
arr.highlight(7);
av.step();
av.umsg("So now we look in the permuation array for the value at position perm[3], and add that value to the home slot index (which is 0), to get a value of 6. Unfortunately, slot 6 is full as well!");
arr.unhighlight(7);
arr.highlight(6);
av.step();
av.umsg("So now we look in the permuation array for the value at position perm[4], and add that value to the home slot index (which is 0), to get a value of 1. Finally!");
arr.unhighlight(6);
arr.highlight(1);
arr.value(1, 110);
av.step();
av.umsg("Of course, any permutation is possible. Even one that gives us a bad probe sequence, such as the same as we would get from linear probing. But this will almost never happen in practice, since any given permutation is expected to appear once in n! tries.");
var i;
arr.unhighlight(1);
for (i = 0; i < 10; i++) { arr.value(i, ""); }
for (i = 0; i < 10; i++) { perm.value(i, i); }
av.recorded();
});
|
const translateErrorMsg = errorMsg => {
switch (errorMsg) {
case "Missing required parameter USERNAME":
return "Ingrese correctamente el email";
case "Incorrect username or password.":
return "Email o password incorrectos";
case "User does not exist.":
return "El email no se encuentra registrado";
case "Not a valid JWT token":
return "Token inválido. Cierre su sesión y vuelva a intentarlo";
case "Invalid token":
return "Token inválido. Cierre su sesión y vuelva a intentarlo";
case "Unable to download JWKs":
return "No se puede realizar la validación del usuario por un problema en la conexión con aws cognito";
case "An account with the given email already exists.":
return "El usuario ya existe"
case "Invalid email address format.":
return "El formato del Email es inválido"
default:
return errorMsg;
}
};
export default translateErrorMsg;
|
"use strict";
function ComponentCollection() {
if (ComponentCollection._instanceAlreadyCreated) {
if(console && console.warn)
console.warn("Another instance of the ComponentCollection has been generated. There should only be 1 instantiated for the lifetime of the application.");
}
ComponentCollection._instanceAlreadyCreated = true;
// This arrow holds pointers to every Component definition... regardless of how many component instances have been created.
this._componentObjArr = [];
// Every time a new instance of a Component object is instantiated it should be added to this object.
// The keys point to unique Element ID's in the DOM (if they still exist) and the values are pointers to the ComponentInstance objects.
this._componentInstancesArr = {};
this._isDigestCycleRunning = false;
this._digestCycleRequestQueue = 0;
};
// It is expected that this method should be called in response to a State change.
// When invoked this method will loop over all of the Component Instances and ask them to update themselves.
// Each Component Instances should be smart enough to avoid re-rendering themselves if its segment of the State is unchanged from last time and also if they have been detached from the DOM.
ComponentCollection.prototype.runDigestCycle = function () {
console.log("Running Digest Cycle");
if(this._isDigestCycleRunning){
console.log("Received another request to digest while another is in progress.");
// There's no reason to queue up more than one request because a tailing digest will clean everything up.
var maxDigestQueueLength = 1;
if(this._digestCycleRequestQueue < maxDigestQueueLength)
this._digestCycleRequestQueue++;
return;
}
// Just in case any new Component Instances were inserted this will ensure that their initialization routines are executed.
// This shouldn't be needed unless View.renderHtml() is called outside of the boot process or the ComponentInstance._forceRender() method.
this.runDomBindRoutinesIfNeeded();
// This method will spider the DOM for the <componentWrapper> tags and create an array of instances sorted by hierarchical depth.
// Parent instances should be called on to re-render themselves before children because if a node is going to be removed from the DOM by a state-change it would be a waste of cycles to have it update itself.
var componentWrapperDepthsArr = this._getComponentNodeDepths();
// Use the same copy of the Global State throughout all components in the collection for performance.
var globalStateObj = HIPI.framework.AppState.getStoreObj();
for(var i=0; i<componentWrapperDepthsArr.length; i++){
var loop_componentWrapperId = componentWrapperDepthsArr[i].componentElemId;
if(!this._componentInstancesArr[loop_componentWrapperId])
throw new Error("Error in method runDigestCycle. Unable to correlate the Component Wrapper found in the DOM with an instance in the collection for Element Id: " + loop_componentWrapperId);
// It's possible that a Component in the collection has been removed from the DOM as the current loop has been processed.
if(!this._componentInstancesArr[loop_componentWrapperId].isComponentInDOM()){
console.log("This component is no longer in the DOM: " + loop_componentWrapperId);
continue;
}
this._componentInstancesArr[loop_componentWrapperId].possiblyReRender(globalStateObj);
}
this._isDigestCycleRunning = false;
// Startup the next Digest Cycle with a little breather.
if(this._digestCycleRequestQueue){
this._digestCycleRequestQueue--;
var scopeThis = this;
setTimeout(function(){
scopeThis.runDigestCycle();
}, 50);
}
};
// This will return an array of objects with a shape of {nodeDepth:1, componentElemId:'elementIdOfComponentInstance'} and the array will be sorted with lowest depths first (closest to the root).
ComponentCollection.prototype._getComponentNodeDepths = function () {
if(!document.body)
throw new Error("Error in method _getComponentNodeDepths. The document.body tag can't be null at the time this method is called.");
var elemObjArr = [];
recurseDocumentStructure(document.body, 0);
elemObjArr.sort(function(a, b){
return a.nodeDepth - b.nodeDepth;
});
return elemObjArr;
function recurseDocumentStructure(currentParent, currentDepthCounter){
currentDepthCounter++;
var childNodesArr = currentParent.children;
for(var i=0; i<childNodesArr.length; i++){
var loop_childNode = childNodesArr[i];
// All browsers set the tagName in upper-case, regardless of the case in the source HTML document.
// However a popular non-open browser is showing "svg" as lowercase.
var upperCaseTagName = (loop_childNode.tagName + "").toUpperCase();
if(["SCRIPT", "SVG"].indexOf(upperCaseTagName) > -1)
continue;
if(loop_childNode.tagName === "COMPONENTWRAPPER"){
if(!loop_childNode.hasAttributes() || !loop_childNode.getAttribute("id"))
throw new Error("Found a componentWrapper tag without an ID attribute.");
var componentWrapperId = loop_childNode.getAttribute("id");
elemObjArr.push({'nodeDepth': currentDepthCounter, 'componentElemId': componentWrapperId});
}
recurseDocumentStructure(loop_childNode, currentDepthCounter);
}
}
};
ComponentCollection.prototype.addComponentInstance = function (elementIdOfComponentInstance, componentInstanceObj) {
HIPI.framework.Utilities.ensureObjectOfClassType(componentInstanceObj, "ComponentInstance");
HIPI.framework.Utilities.ensureTypeString(elementIdOfComponentInstance);
if(!elementIdOfComponentInstance.match(/^\w+$/))
throw new Error("Error in method ComponentCollection.addComponentInstance. The given ElementId appears to be invalid: " + elementIdOfComponentInstance);
if(this._componentInstancesArr[elementIdOfComponentInstance])
throw new Error("Error in method ComponentCollection.addComponentInstance. The given ElementId has already been added: " + elementIdOfComponentInstance);
this._componentInstancesArr[elementIdOfComponentInstance] = componentInstanceObj;
};
ComponentCollection.prototype.addComponent = function (componentObj) {
HIPI.framework.Utilities.ensureObjectOfClassType(componentObj, "Component");
var htmlSelectorOfComponentToBeAdded = componentObj.getHtmlElementSelector();
var existingSelectorNamesArr = this.getAllComponentHtmlElementNames();
if(existingSelectorNamesArr.indexOf(htmlSelectorOfComponentToBeAdded) > -1)
throw new Error("Error in ComponentCollection.addComponent. The Component being added already exists within the collection: " + htmlSelectorOfComponentToBeAdded);
if(!componentObj.getHtmlGenerator())
throw new Error("Error in ComponentCollection.addComponent. The Component being added does not have an HTML generator function defined: " + htmlSelectorOfComponentToBeAdded);
this._componentObjArr.push(componentObj);
};
ComponentCollection.prototype.getAllComponentHtmlElementNames = function () {
var retArr = [];
for(var i=0; i<this._componentObjArr.length; i++)
retArr.push(this._componentObjArr[i].getHtmlElementSelector());
return retArr;
};
ComponentCollection.prototype.getComponentObjectByHtmlSelector = function (htmlSelectorStr) {
HIPI.framework.Utilities.ensureTypeString(htmlSelectorStr);
for(var i=0; i<this._componentObjArr.length; i++){
if(this._componentObjArr[i].getHtmlElementSelector() === htmlSelectorStr)
return this._componentObjArr[i];
}
throw new Error("Error in method ComponentCollection.getComponentObjectByHtmlSelector. The component name could not be found within the collection: " + htmlSelectorStr);
};
// The object returned from this method, as well as the component reducers, is likely to point to the same object which is given (but not necessarily).
// The state object is not copied between reducers for performance reasons.
ComponentCollection.prototype.runComponentReducers = function (stateObj, actionObj) {
HIPI.framework.Utilities.ensureTypeObject(stateObj);
HIPI.framework.Utilities.ensureTypeObject(actionObj);
for(var i=0; i<this._componentObjArr.length; i++){
if(this._componentObjArr[i].getReducer())
stateObj = this._componentObjArr[i].getReducer()(stateObj, actionObj);
}
return stateObj;
};
ComponentCollection.prototype.runComponentStateCleaners = function (stateObj) {
HIPI.framework.Utilities.ensureTypeObject(stateObj);
var stateCopyObj = stateObj;
for(var i=0; i<this._componentObjArr.length; i++){
if(this._componentObjArr[i].getStateCleaner()){
var loop_StateObj = this._componentObjArr[i].getStateCleaner()(HIPI.framework.Utilities.copyObject(stateCopyObj));
if(JSON.stringify(loop_StateObj) !== JSON.stringify(stateCopyObj))
console.log("The <"+this._componentObjArr[i].getHtmlElementSelector()+"> component state cleaner modified the global state.");
stateCopyObj = loop_StateObj;
}
}
return HIPI.framework.Utilities.copyObject(stateCopyObj);
};
ComponentCollection.prototype.runDomBindRoutinesIfNeeded = function () {
// Run the DOM Updated callbacks in hierarchical order.
var componentWrapperDepthsArr = this._getComponentNodeDepths();
for(var i=0; i<componentWrapperDepthsArr.length; i++){
var loop_componentWrapperId = componentWrapperDepthsArr[i].componentElemId;
if(!this._componentInstancesArr[loop_componentWrapperId])
throw new Error("Error in method runDomBindRoutinesIfNeeded. Unable to correlate the Component Wrapper found in the DOM with an instance in the collection for Element Id: " + loop_componentWrapperId);
this._componentInstancesArr[loop_componentWrapperId].possiblyRunDomBindFunction();
}
};
|
import * as firebase from 'firebase';
// Initialize Firebase
const firebaseConfig = {
apiKey: "AIzaSyBolnqghsxdV0OvTUM6RqAgpD6Yz2Zi8QU",
authDomain: "geoz-9db4d.firebaseapp.com",
databaseURL: "https://geoz-9db4d.firebaseio.com",
// projectId: "geoz-9db4d",
storageBucket: "geoz-9db4d.appspot.com",
// messagingSenderId: "542075108993"
};
const firebaseApp = firebase.initializeApp(firebaseConfig);
export default firebase;
|
import React, { Component } from 'react';
import { connect } from 'react-redux';
import * as actions from '../actions';
import requireAuth from './requireAuth';
class CommentBox extends Component {
state = { comment: '' };
handleChange = (e) => {
this.setState({ comment: e.target.value });
};
handleSubmit = (e) => {
e.preventDefault();
// call an action creator
this.props.saveComment(this.state.comment);
// and clear the textarea
this.setState({ comment: '' });
};
render() {
return (
<div>
<form onSubmit={this.handleSubmit}>
<h4>Add a comment</h4>
<textarea
name=''
id=''
cols='30'
rows='10'
value={this.state.comment}
onChange={this.handleChange}
/>
<div>
<button>Add Comment</button>
</div>
</form>
<div>
<button onClick={this.props.fetchComments}>
Fetch Comments
</button>
</div>
</div>
);
}
}
export default connect(null, actions)(requireAuth(CommentBox));
|
/*
* Module code goes here. Use 'module.exports' to export things:
* module.exports.thing = 'a thing';
*
* You can import it from another modules like this:
* var mod = require('prototype.container');
* mod.thing == 'a thing'; // true
*/
var logger = require("screeps.logger");
logger = new logger("prototype.container");
StructureContainer.prototype.mineralAmount = function() {
return _.sum(this.store) - this.store.energy;
}
StructureContainer.prototype.getSource = function() {
if (this.s == undefined) {
var conts = this.pos.findInRange(FIND_SOURCES, 1);
this.s = conts[0];
}
return this.s;
}
StructureContainer.prototype.getMineral = function() {
if (this.m == undefined) {
var conts = this.pos.findInRange(FIND_MINERALS, 1);
this.m = conts[0];
}
return this.m;
}
StructureContainer.prototype.getSpawn = function() {
if (this.sp == undefined) {
var conts = this.pos.findInRange(FIND_MY_SPAWNS, 1);
this.sp = conts[0];
}
return this.sp;
}
|
function attachEvents() {
const baseUrl = 'https://baas.kinvey.com/appdata/kid_HJBUjKi5f';
const kinveyUsername = 'test';
const kinveyPassword = 'test';
const base64auth = btoa(kinveyUsername + ":" + kinveyPassword);
const authHeaders = {
'Authorization': 'Basic ' + base64auth,
'Content-type': 'application/json'
};
$('#aside').find('.load').click(listAllCatches);
$('#addForm').find('.add').click(addCatch);
function listAllCatches() {
$.ajax({
method: 'GET',
url: baseUrl + '/biggestCatches',
headers: authHeaders
}).then(displayCatches)
}
function displayCatches(res) {
$('#catches').empty();
for (let _catch of res) {
let id = _catch['_id'];
let angler = _catch['angler'];
let weight = _catch['weight'];
let species = _catch['species'];
let location = _catch['location'];
let bait = _catch['bait'];
let captureTime = _catch['captureTime'];
displayCatch(id, angler, weight, species, location, bait, captureTime, _catch);
}
}
function addCatch() {
let obj = getAllFieldsData('#addForm');
$.ajax({
method: 'POST',
url: baseUrl + '/biggestCatches',
headers: authHeaders,
data: JSON.stringify(obj)
}).then(listAllCatches).catch(handleAjaxError);
}
function getAllFieldsData(selector) {
let catchObj = {};
$(selector).parent().find('input').each((index, element) => {
if(element.type === 'text'){
catchObj[element.className] = element.value;
}else{
catchObj[element.className] = Number(element.value);
}
});
return catchObj;
}
function updateCatch(ev) {
let catchObj = getAllFieldsData(ev.target);
$.ajax({
method: 'PUT',
url: baseUrl + '/biggestCatches/' + this['_id'],
headers: authHeaders,
data: JSON.stringify(catchObj)
}).then(listAllCatches).catch(handleAjaxError);
}
function deleteCatch(ev) {
$.ajax({
method: 'DELETE',
url: baseUrl + '/biggestCatches/' + this['_id'],
headers: authHeaders
}).then(listAllCatches).catch(handleAjaxError);
}
function displayCatch(id, angler, weight, species, location, bait, captureTime, _catch) {
let mainDiv = $(`<div class="catch" data-id="${id}">`);
let anglerLabel = $('<label>Angler</label>');
let anglerInput = $(`<input type="text" class="angler" value="${angler}"/>`);
let weightLabel = $('<label>Weight</label>');
let weightInput = $(`<input type="number" class="weight" value="${weight}"/>`);
let speciesLabel = $('<label>Species</label>');
let speciesInput = $(`<input type="text" class="species" value="${species}"/>`);
let locationLabel = $('<label>Location</label>');
let locationInput = $(`<input type="text" class="location" value="${location}"/>`);
let baitLabel = $('<label>Bait</label>');
let baitInput = $(`<input type="text" class="bait" value="${bait}"/>`);
let captureLabel = $('<label>Capture Time</label>');
let captureInput = $(`<input type="number" class="captureTime" value="${captureTime}"/>`);
let updateButton = $(`<button class="update">Update</button>`).click(updateCatch.bind(_catch));
let deleteButton = $(`<button class="delete">Delete</button>`).click(deleteCatch.bind(_catch));
mainDiv.append(anglerLabel)
.append(anglerInput)
.append(weightLabel)
.append(weightInput)
.append(speciesLabel)
.append(speciesInput)
.append(locationLabel)
.append(locationInput)
.append(baitLabel)
.append(baitInput)
.append(captureLabel)
.append(captureInput)
.append(updateButton)
.append(deleteButton);
$('#catches').append(mainDiv);
}
function handleAjaxError(res) {
}
}
|
var express = require('express');
var mongoose = require('mongoose');
var bodyparser = require('body-parser');
var cors = require('cors');
var path = require('path');
var app = express();
const prodRoute = require('./routes/prodRoute.js')
const saleRoute = require('./routes/saleRoute.js')
mongoose.connect('mongodb://localhost:27017/Products');
mongoose.Promise = global.Promise;
mongoose.connection.on('connected', function(){
console.log('Connection successfully established to mongodb @ 27017');
});
mongoose.connection.on('error', function(err){
if(err){
console.log('Error in connecting to mongodb @ 27017: ' + err)
}
});
const port = 3000;
app.get('/', function(req, res){
res.send();
});
//adding middleware - cors
app.use(cors());
//body-parser
app.use(bodyparser.json());
app.use(express.static(path.join(__dirname, 'public')));
//routes
app.use('/p', prodRoute);
app.use('/s', saleRoute);
// background.checkStock();
app.listen(port, function(){
console.log('Server started at port: ' + port);
});
|
/* jshint esversion: 6 */
const express = require('express');
const shell = require('shelljs');
const path = require('path');
const multer = require('multer');
const unzip = require('unzip');
const fs = require('fs');
const bddUtils = require('../../utils/bddUtils')
const reportutils = require('../../utils/reportUtils');
const apks = path.normalize(`${process.cwd()}/apks`);
const tests = path.normalize(`${process.cwd()}/tests`);
var router = express.Router();
router.get('/:appId/version/:version/reports', (req, res) => {
const { appId, version } = req.params;
let reports = reportutils.getAvailableReports(appId, version, 'bdd')
res.json(reports)
})
router.get('/:appId/version/:version/reports/:timestampId', (req, res) => {
const { appId, timestampId, version } = req.params;
let report = reportutils.getReport(appId, version, 'bdd', timestampId)
if(!report.error) {
res.json(report)
} else {
res.status(404).json(report.error)
}
})
router.post('/:appId/version/:version/run', async (req, res) => {
let { appId, version } = req.params;
const { avds } = req.body
res.json({message:'Starting calabash'});
await bddUtils.runBDD( { appId, version } , avds)
console.log(`Finsished running bdd tests for app: ${appId}`)
});
router.get('/:appId/run', (req, res) => {
const { appId } = req.params
const isRunning = bddUtils.getRunningBdd(appId)
res.json({isRunning: isRunning})
});
var storage = multer.diskStorage({
destination: (req, file, cb) => {
const appTestPath = path.normalize(`${tests}/${req.params.appId}/${req.params.version}`)
shell.mkdir('-p', appTestPath)
cb(null, appTestPath);
},
filename: function (req, file, cb) {
cb(null, `${req.params.version}.zip`);
}
});
var upload = multer({
storage: storage
});
router.post('/:appId/version/:version', upload.single('test'), (req, res) => {
const appTestPath = path.normalize(`${tests}/${req.params.appId}/${req.params.version}`)
const testZip = path.normalize(`${appTestPath}/${req.params.version}.zip`)
fs.createReadStream(testZip).pipe(unzip.Extract({ path: appTestPath }));
shell.rm(testZip);
res.send('File uploaded');
});
module.exports = router;
|
'use strict';
/**
* @ngdoc function
* @name cop21App.controller:MockupCtrl
* @description
* # MockupCtrl
* Controller of the cop21App
*/
angular.module('cop21App')
.controller('MockupCtrl', function ($scope) {
$scope.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
});
|
let CharactersCtrl = function($scope, CharactersService, $state) {
CharactersService.getCharacters().then( (res) => {
console.log(res);
$scope.characters = res.data.results;
})
};
CharactersCtrl.$inject = ['$scope', 'CharactersService', '$state'];
export default CharactersCtrl;
|
module.exports = [
178416,
676461
]
|
'use strict';
console.log('task loaded');
var PM = (function (module) {
var host = 'http://localhost:3000/',
authToken = localStorage.getItem('authToken'),
projectId = localStorage.getItem('projectId'),
taskId = localStorage.getItem('taskId');
module.apiRoutes = {
users: host + 'users/',
projects: host + 'projects/',
tasks: host + 'tasks/',
comments: host + 'comments/',
fileLocations: host + 'file_locations/'
};
module.getTasks = function(project_id) {
$.ajax({
url: module.apiRoutes.projects + project_id + '/tasks',
type: 'GET',
headers: { 'AUTHORIZATION': 'Token token=' + authToken }
}).done(function(data) {
console.log(data);
}).fail(function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
});
};
module.getOneTask = function(id) {
$.ajax({
url: module.apiRoutes.tasks + id,
type: 'GET',
headers: { 'AUTHORIZATION': 'Token token=' + authToken }
}).done(function(data) {
var supercomments = module.getSupercomments(data);
localStorage.setItem('taskId', data.id);
Handlebars.partials = Handlebars.templates;
var template = Handlebars.templates.taskShowTemplate;
$('#column-right').html(template({task: data, comments: supercomments}));
}).fail(function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
});
};
module.getSupercomments = function(data){
var supercomments = [];
for(var i=0; i<data.comments.length; i++){
if (data.comments[i].supercomment_id === null){
supercomments.push(data.comments[i]);
}
}
return supercomments;
};
module.createTask = function(event) {
projectId = localStorage.getItem('projectId');
event.preventDefault();
$.ajax({
url: module.apiRoutes.projects + projectId + '/tasks',
type: 'POST',
headers: { 'AUTHORIZATION': 'Token token=' + authToken },
data: { task: {
due_date: $('.new-task-form .taskDueDate').val(),
completed: $('.new-task-form .taskCompleted').is(':checked'),
priority: $('.new-task-form .taskPriority').val(),
title: $('.new-task-form .taskTitle').val(),
description: $('.new-task-form .taskDescription').val()
}
}
}).done(function() {
window.location.href = '/#/projects/'+ projectId;
}).fail(function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
});
};
// module.updateTask = function() {
// $('#container').on('click', '#update-task-button', PM.showTaskForm) , function() {
// $('#taskTitle').val('#taskTitle');
// $('#taskDescription').val('#taskDescription');
// $('#taskDueDate').val('#taskDueDate');
// $('#taskCompleted').is(':checked');
// $('#taskPriority').val('#taskPriority');
// };
// };
module.patchTask = function(event, id) {
event.preventDefault();
$.ajax({
url: module.apiRoutes.tasks + id,
type: 'PATCH',
headers: { 'AUTHORIZATION': 'Token token=' + authToken },
data: { task: {
due_date: $('input#taskDueDate').val(),
completed: $('input#taskCompleted').is(':checked'),
priority: $('select#taskPriority').val(),
title: $('input#taskTitle').val(),
description: $('textarea#taskDescription').val()
}
}
}).done(function(data) {
console.log(data);
}).fail(function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
});
};
module.deleteTask = function(event, id) {
event.preventDefault();
$.ajax({
url: module.apiRoutes.tasks + id,
type: 'DELETE',
headers: { 'AUTHORIZATION': 'Token token=' + authToken }
}).done(function(data){
console.log(data);
location.reload();
}).fail(function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
});
};
module.createSubtask = function(event) {
event.preventDefault();
taskId = localStorage.getItem('taskId');
$.ajax({
url: module.apiRoutes.tasks + taskId + '/subtasks',
type: 'POST',
headers: { 'AUTHORIZATION': 'Token token=' + authToken },
data: { task: {
due_date: $('.new-subtask-form .taskDueDate').val(),
completed: $('.new-subtask-form .taskCompleted').is(':checked'),
priority: $('.new-subtask-form .taskPriority').val(),
title: $('.new-subtask-form .taskTitle').val(),
description: $('.new-subtask-form .taskDescription').val()
}
}
}).done(function() {
window.location.href = '/#/tasks/'+ taskId;
}).fail(function(data) {
console.log(data);
});
};
module.showTaskForm = function(){
$('.new-task-form').toggle();
};
module.showSubtaskForm = function(){
$('.new-subtask-form').toggle();
};
$('.newTaskForm').on('submit', module.createTask);
return module;
})(PM || {});
$(document).ready(function() {
});
|
'use strict';
/* globals module, element, by , xpath*/
var regPersonalInfoPage = function() {
this.userDetails = {
personalInfoHeader : element(by.xpath("//h1[text()='Personal Information']")),
nameHeader : element(by.xpath("//h1[text()='NAME']")),
firstNameText : element(by.id("givenName")),
lastNameText : element(by.id("familyName")),
addTitleLink : element(by.xpath("//p[contains(text(), 'Add titles, and additional name')]")),
prefixText : element(by.id("prefix")),
middleNameText : element(by.id("middleName")),
suffixText : element(by.id("postfix")),
addressHeader : element(by.xpath("//h1[text()='Address']")),
address1Editbox : element(by.css('input[placeholder=\"Address\"]')),
zipcodeEditbox : element(by.css('input[placeholder=\"Zip Code\"]')),
cityEditbox : element(by.css('input[placeholder=\"City\"]')),
stateEditbox : element(by.css('input[placeholder=\"State\"]')),
ssnEditBox : element(by.css('input[placeholder=\"Social Security Number\"]')),
dobEditBox : element(by.css('input[placeholder=\"Date of birth\"]')),
};
this.confirmDetails = {
dobConfirmLabel : element(by.name('dob')),
ssnConfirmLabel : element(by.name('ssnInfo'))
//dobConfirmLabel : element(by.css('input[name=\"dob\"]')),
//ssnConfirmLabel : element(by.css('input[name=\"ssnInfo\"]')),
}
};
module.exports = new regPersonalInfoPage();
|
var path = require('path');
module.exports = function(config) {
if ( ! process.env.SAUCE_USERNAME || ! process.env.SAUCE_ACCESS_KEY) {
console.error('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.');
process.exit(1);
}
var customLaunchers = {
'chrome-1': {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'macOS 10.14',
version: 'latest-1'
},
'firefox': {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Windows 10',
version: 'latest'
},
'firefox-1': {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'macOS 10.14',
version: 'latest-1'
},
'edge': {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
platform: 'Windows 10',
version: 'latest'
},
'edge-1': {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
platform: 'Windows 10',
version: 'latest-1'
},
'msie10': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8',
version: '10.0'
},
'msie11': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 10',
version: '11.103'
},
'safari12': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'macOS 10.14',
version: '12.0'
},
'safari13': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'macOS 10.13',
version: '13.0'
},
'ios11': {
base: 'SauceLabs',
browserName: 'Safari',
platformName: 'iOS',
platformVersion: '11.3',
deviceName: 'iPhone X Simulator',
idleTimeout: 120
},
'ios12': {
base: 'SauceLabs',
browserName: 'Safari',
platformName: 'iOS',
platformVersion: '12.2',
deviceName: 'iPhone XR Simulator',
idleTimeout: 120
},
'android51': {
base: 'SauceLabs',
browserName: 'Browser',
platformName: 'Android',
platformVersion: '5.1',
deviceName: 'Android Emulator'
},
'android9': {
base: 'SauceLabs',
browserName: 'Chrome',
platformName: 'Android',
platformVersion: '8.0',
deviceName: 'Android GoogleAPI Emulator'
}
};
config.set({
basePath: '',
frameworks: ['mocha'],
files: [
'https://unpkg.com/nette-forms/src/assets/netteForms.js',
'tests/index.js'
],
preprocessors: {
'tests/index.js': ['webpack']
},
webpack: {
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
sourceMap: false
}
},
exclude: /node_modules/
}
],
},
devtool: ''
},
reporters: ['dots', 'saucelabs'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
singleRun: true,
sauceLabs: {
testName: 'Naja.js',
build: process.env.TRAVIS_BUILD_NUMBER
},
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
browserDisconnectTolerance: 2,
browserNoActivityTimeout: 120000,
captureTimeout: 120000, // try to give ios simulators some time to boot up
concurrency: 5
})
};
|
export default [{
'provinceInfo': {
'name': 'Phnom Penh',
'districtInfos': [{
'name': 'Khan Chamkar Mon',
'communes': [{
'name': 'Tonle Bassac',
'type': 'Urban Commune'
}, {
'name': 'Boeung Trobaek',
'type': 'Urban Commune'
}, {
'name': 'Phsar Daem Thkov',
'type': 'Urban Commune'
}, {
'name': 'Tuol Tompoung I',
'type': 'Urban Commune'
}, {
'name': 'Tuol Tompoung II',
'type': 'Urban Commune'
}]
}, {
'name': 'Doun Penh',
'communes': [{
'name': 'Srah Chak',
'type': 'Urban Commune'
}, {
'name': 'Wat Phnom',
'type': 'Urban Commune'
}, {
'name': 'Phsar Chas',
'type': 'Urban Commune'
}, {
'name': 'Phsar Kandal I',
'type': 'Urban Commune'
}, {
'name': 'Phsar Kandal II',
'type': 'Urban Commune'
}, {
'name': 'Chey Chomneas',
'type': 'Urban Commune'
}, {
'name': 'Chaktomuk',
'type': 'Urban Commune'
}, {
'name': 'Phsar Thmey I',
'type': 'Urban Commune'
}, {
'name': 'Phsar Thmey II',
'type': 'Urban Commune'
}, {
'name': 'Phsar Thmey III',
'type': 'Urban Commune'
}, {
'name': 'Boeung Raing',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Prampir Makara',
'communes': [{
'name': 'Monorom',
'type': 'Urban Commune'
}, {
'name': 'Mittapheap',
'type': 'Urban Commune'
}, {
'name': 'Veal Vong',
'type': 'Urban Commune'
}, {
'name': 'Orussey I',
'type': 'Urban Commune'
}, {
'name': 'Orussey II',
'type': 'Urban Commune'
}, {
'name': 'Orussey III',
'type': 'Urban Commune'
}, {
'name': 'Orussey IV',
'type': 'Urban Commune'
}, {
'name': 'Boeung Prolit',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Tuol Kouk',
'communes': [{
'name': 'Boeung Kak I',
'type': 'Urban Commune'
}, {
'name': 'Boeung Kak II',
'type': 'Urban Commune'
}, {
'name': 'Phsar Depo I',
'type': 'Urban Commune'
}, {
'name': 'Phsar Depo II',
'type': 'Urban Commune'
}, {
'name': 'Phsar Depo III',
'type': 'Urban Commune'
}, {
'name': 'Teuk L\'ak I',
'type': 'Urban Commune'
}, {
'name': 'Teuk L\'ak II',
'type': 'Urban Commune'
}, {
'name': 'Teuk L\'ak III',
'type': 'Urban Commune'
}, {
'name': 'Phsar Daeum Kor',
'type': 'Urban Commune'
}, {
'name': 'Boeung Salang',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Dangkao',
'communes': [{
'name': 'Dangkao',
'type': 'Urban Commune'
}, {
'name': 'Pong Tuek',
'type': 'Urban Commune'
}, {
'name': 'Prey Veaeng',
'type': 'Urban Commune'
}, {
'name': 'Prey Sa',
'type': 'Urban Commune'
}, {
'name': 'Krang Pongro',
'type': 'Urban Commune'
}, {
'name': 'Prateah Lang',
'type': 'Urban Commune'
}, {
'name': 'Sak Sampov',
'type': 'Urban Commune'
}, {
'name': 'Cheung Aek',
'type': 'Urban Commune'
}, {
'name': 'Kong Noy',
'type': 'Urban Commune'
}, {
'name': 'Preaek Kampues',
'type': 'Urban Commune'
}, {
'name': 'Roluos',
'type': 'Urban Commune'
}, {
'name': 'Spean Thma',
'type': 'Urban Commune'
}, {
'name': 'Tien',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Mean Chey',
'communes': [{
'name': 'Chak Angrae Leu',
'type': 'Urban Commune'
}, {
'name': 'Chak Angrae Kraom',
'type': 'Urban Commune'
}, {
'name': 'Stueng Mean Chey 1',
'type': 'Urban Commune'
}, {
'name': 'Stueng Mean Chey 2',
'type': 'Urban Commune'
}, {
'name': 'Stueng Mean Chey 3',
'type': 'Urban Commune'
}, {
'name': 'Boeng Tumpun 1',
'type': 'Urban Commune'
}, {
'name': 'Boeng Tumpun 2',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Russey Keo',
'communes': [{
'name': 'Svay Pak',
'type': 'Urban Commune'
}, {
'name': 'Kilomaetr 7',
'type': 'Urban Commune'
}, {
'name': 'Russey Keo',
'type': 'Urban Commune'
}, {
'name': 'Chrang Chamreh I',
'type': 'Urban Commune'
}, {
'name': 'Chrang Chamreh II',
'type': 'Urban Commune'
}, {
'name': 'Tuol Sangkae I',
'type': 'Urban Commune'
}, {
'name': 'Tuol Sangkae II',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Sen Sok',
'communes': [{
'name': 'Phnom Penh Thmei',
'type': 'Urban Commune'
}, {
'name': 'Tuek Thla',
'type': 'Urban Commune'
}, {
'name': 'Khmuonh',
'type': 'Urban Commune'
}, {
'name': 'Krang Thnong',
'type': 'Urban Commune'
}, {
'name': 'Ou Baek K\'am',
'type': 'Urban Commune'
}, {
'name': 'Kouk Khleang',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Pou Senchey',
'communes': [{
'name': 'Trapeang Krasang',
'type': 'Urban Commune'
}, {
'name': 'Samraong Kraom',
'type': 'Urban Commune'
}, {
'name': 'Chaom Chau 1',
'type': 'Urban Commune'
}, {
'name': 'Chaom Chau 2',
'type': 'Urban Commune'
}, {
'name': 'Chaom Chau 3',
'type': 'Urban Commune'
}, {
'name': 'Kakab 1',
'type': 'Urban Commune'
}, {
'name': 'Kakab 2',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Chroy Changvar',
'communes': [{
'name': 'Prek Lieb',
'type': 'Urban Commune'
}, {
'name': 'Prek Ta Sek',
'type': 'Urban Commune'
}, {
'name': 'Chroy Changvar',
'type': 'Urban Commune'
}, {
'name': 'Bak Khaeng',
'type': 'Urban Commune'
}, {
'name': 'Koh Dach',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Prek Pnov',
'communes': [{
'name': 'Ponhea Pon',
'type': 'Urban Commune'
}, {
'name': 'Prek Pnov',
'type': 'Urban Commune'
}, {
'name': 'Samraong',
'type': 'Urban Commune'
}, {
'name': 'Kouk Roka',
'type': 'Urban Commune'
}, {
'name': 'Ponsang',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Chbar Ampov',
'communes': [{
'name': 'Chbar Ampov I',
'type': 'Urban Commune'
}, {
'name': 'Chbar Ampov II',
'type': 'Urban Commune'
}, {
'name': 'Nirouth',
'type': 'Urban Commune'
}, {
'name': 'Prek Pra',
'type': 'Urban Commune'
}, {
'name': 'Prek Aeng',
'type': 'Urban Commune'
}, {
'name': 'Prek Thmei',
'type': 'Urban Commune'
}, {
'name': 'Kbal Koh',
'type': 'Urban Commune'
}, {
'name': 'Veal Sbov',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Boeng Keng Kang',
'communes': [{
'name': 'Boeng Keng Kang 1',
'type': 'Urban Commune'
}, {
'name': 'Boeng Keng Kang 2',
'type': 'Urban Commune'
}, {
'name': 'Boeng Keng Kang 3',
'type': 'Urban Commune'
}, {
'name': 'Olympic',
'type': 'Urban Commune'
}, {
'name': 'Tumnob Tuek',
'type': 'Urban Commune'
}, {
'name': 'Tuol Svay Prey 1',
'type': 'Urban Commune'
}, {
'name': 'Tuol Svay Prey 2',
'type': 'Urban Commune'
}]
}, {
'name': 'Khan Kamboul',
'communes': [{
'name': 'Kamboul',
'type': 'Urban Commune'
}, {
'name': 'Kantouk',
'type': 'Urban Commune'
}, {
'name': 'Ovlaok',
'type': 'Urban Commune'
}, {
'name': 'Snaor',
'type': 'Urban Commune'
}, {
'name': 'Phleung Chheh Roteh',
'type': 'Urban Commune'
}, {
'name': 'Boeng Thum',
'type': 'Urban Commune'
}, {
'name': 'Prateah Lang',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Banteay Meanchey Province',
'districtInfos': [{
'name': 'Mongkol Borei District',
'communes': [{
'name': 'Banteay Neang',
'type': 'Urban Commune'
}, {
'name': 'Bat Trang',
'type': 'Urban Commune'
}, {
'name': 'Chamnaom',
'type': 'Urban Commune'
}, {
'name': 'Kouk Ballangk',
'type': 'Urban Commune'
}, {
'name': 'Koy Maeng',
'type': 'Urban Commune'
}, {
'name': 'Ou Prasat',
'type': 'Urban Commune'
}, {
'name': 'Phnum Touch',
'type': 'Urban Commune'
}, {
'name': 'Rohat Tuek',
'type': 'Urban Commune'
}, {
'name': 'Ruessei Kraok',
'type': 'Urban Commune'
}, {
'name': 'Sambuor',
'type': 'Urban Commune'
}, {
'name': 'Soea',
'type': 'Urban Commune'
}, {
'name': 'Srah Reang',
'type': 'Urban Commune'
}, {
'name': 'Ta Lam',
'type': 'Urban Commune'
}]
}, {
'name': 'Preah Netr Preah District',
'communes': [{
'name': 'Bos Sbov',
'type': 'Urban Commune'
}, {
'name': 'Chhnuor',
'type': 'Urban Commune'
}, {
'name': 'Chob',
'type': 'Urban Commune'
}, {
'name': 'Phnum Lieb',
'type': 'Urban Commune'
}, {
'name': 'Prasat Char',
'type': 'Urban Commune'
}, {
'name': 'Preah Netr',
'type': 'Urban Commune'
}, {
'name': 'Rohal Rohal',
'type': 'Urban Commune'
}, {
'name': 'Tean Kam',
'type': 'Urban Commune'
}, {
'name': 'Tuek Chour Smach',
'type': 'Urban Commune'
}]
}, {
'name': 'Serei Saophoan District',
'communes': [{
'name': 'Kampong Svay',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Pong Satv',
'type': 'Urban Commune'
}, {
'name': 'Mkak',
'type': 'Urban Commune'
}, {
'name': 'Ou Ambel',
'type': 'Urban Commune'
}, {
'name': 'Phniet',
'type': 'Urban Commune'
}, {
'name': 'Preah Ponlea',
'type': 'Urban Commune'
}, {
'name': 'Tuek Thla',
'type': 'Urban Commune'
}]
}, {
'name': 'Svay Chek District',
'communes': [{
'name': 'Phkoam',
'type': 'Urban Commune'
}, {
'name': 'Roluos',
'type': 'Urban Commune'
}, {
'name': 'Sarongk',
'type': 'Urban Commune'
}, {
'name': 'Sla Kram',
'type': 'Urban Commune'
}, {
'name': 'Svay Chek',
'type': 'Urban Commune'
}, {
'name': 'Ta Baen',
'type': 'Urban Commune'
}, {
'name': 'Ta Phou',
'type': 'Urban Commune'
}, {
'name': 'Treas',
'type': 'Urban Commune'
}]
}, {
'name': 'Phnum Srok District',
'communes': [{
'name': 'Nam Tau',
'type': 'Urban Commune'
}, {
'name': 'Paoy Char',
'type': 'Urban Commune'
}, {
'name': 'Phnom Dei',
'type': 'Urban Commune'
}, {
'name': 'Ponley',
'type': 'Urban Commune'
}, {
'name': 'Spean Sraeng Rouk',
'type': 'Urban Commune'
}, {
'name': 'Srah Chik',
'type': 'Urban Commune'
}]
}, {
'name': 'Ou Chrov District',
'communes': [{
'name': 'Changha',
'type': 'Urban Commune'
}, {
'name': 'Koub',
'type': 'Urban Commune'
}, {
'name': 'Kuttasat',
'type': 'Urban Commune'
}, {
'name': 'Ou Bei Choan',
'type': 'Urban Commune'
}, {
'name': 'Samraong',
'type': 'Urban Commune'
}, {
'name': 'Soengh',
'type': 'Urban Commune'
}, {
'name': 'Souphi',
'type': 'Urban Commune'
}]
}, {
'name': 'Thma Puok District',
'communes': [{
'name': 'Banteay Chhmar',
'type': 'Urban Commune'
}, {
'name': 'Kouk Kakthen',
'type': 'Urban Commune'
}, {
'name': 'Kouk Romiet',
'type': 'Urban Commune'
}, {
'name': 'Kumru',
'type': 'Urban Commune'
}, {
'name': 'Phum Thmei',
'type': 'Urban Commune'
}, {
'name': 'Thma Puok',
'type': 'Urban Commune'
}]
}, {
'name': 'Malai District',
'communes': [{
'name': 'Boeng Beng',
'type': 'Urban Commune'
}, {
'name': 'Malai',
'type': 'Urban Commune'
}, {
'name': 'Ou Sampor',
'type': 'Urban Commune'
}, {
'name': 'Ou Sralau',
'type': 'Urban Commune'
}, {
'name': 'Ta Kong',
'type': 'Urban Commune'
}, {
'name': 'Tuol Pongro',
'type': 'Urban Commune'
}]
}, {
'name': 'Poay Paet Municipality',
'communes': [{
'name': 'Nimitt',
'type': 'Urban Commune'
}, {
'name': 'Paoy Paet',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Battambang Province',
'districtInfos': [{
'name': 'Banan District',
'communes': [{
'name': 'Kantueu Muoy',
'type': 'Urban Commune'
}, {
'name': 'Kantueu Pir',
'type': 'Urban Commune'
}, {
'name': 'Bay Damram',
'type': 'Urban Commune'
}, {
'name': 'Chheu Teal',
'type': 'Urban Commune'
}, {
'name': 'Chaeng Mean Chey',
'type': 'Urban Commune'
}, {
'name': 'Phnum Sampov',
'type': 'Urban Commune'
}, {
'name': 'Snoeng',
'type': 'Urban Commune'
}, {
'name': 'Ta Kream',
'type': 'Urban Commune'
}]
}, {
'name': 'Bavel District',
'communes': [{
'name': 'Bavel',
'type': 'Urban Commune'
}, {
'name': 'Khnach Romeas',
'type': 'Urban Commune'
}, {
'name': 'Lvea',
'type': 'Urban Commune'
}, {
'name': 'Prey Khpos',
'type': 'Urban Commune'
}, {
'name': 'Ampil Pram Daeum',
'type': 'Urban Commune'
}, {
'name': 'Kdol Tahen',
'type': 'Urban Commune'
}]
}, {
'name': 'Rotanak Mondol District',
'communes': [{
'name': 'Sdau',
'type': 'Urban Commune'
}, {
'name': 'Andaeuk Haeb',
'type': 'Urban Commune'
}, {
'name': 'Phlov Meas',
'type': 'Urban Commune'
}, {
'name': 'Traeng',
'type': 'Urban Commune'
}]
}, {
'name': 'Sampov Loun District',
'communes': [{
'name': 'Sampou Lun',
'type': 'Urban Commune'
}, {
'name': 'Angkor Ban',
'type': 'Urban Commune'
}, {
'name': 'Ta Sda',
'type': 'Urban Commune'
}, {
'name': 'Santepheap',
'type': 'Urban Commune'
}, {
'name': 'Serei Maen Cheay',
'type': 'Urban Commune'
}, {
'name': 'Chrey Sema',
'type': 'Urban Commune'
}]
}, {
'name': 'Thma Koul District',
'communes': [{
'name': 'Ta Pung',
'type': 'Urban Commune'
}, {
'name': 'Ta Meun',
'type': 'Urban Commune'
}, {
'name': 'Ou Ta Ki',
'type': 'Urban Commune'
}, {
'name': 'Chrey',
'type': 'Urban Commune'
}, {
'name': 'Anlong Run',
'type': 'Urban Commune'
}, {
'name': 'Chrouy Sdau',
'type': 'Urban Commune'
}, {
'name': 'Boeng Pring',
'type': 'Urban Commune'
}, {
'name': 'Kouk Khmum',
'type': 'Urban Commune'
}, {
'name': 'Bansay Traeng',
'type': 'Urban Commune'
}, {
'name': 'Rung Chrey',
'type': 'Urban Commune'
}]
}, {
'name': 'Aek Phnum District',
'communes': [{
'name': 'Preaek Norint',
'type': 'Urban Commune'
}, {
'name': 'Samraong Knong',
'type': 'Urban Commune'
}, {
'name': 'Preaek Khpob',
'type': 'Urban Commune'
}, {
'name': 'Preaek Luong',
'type': 'Urban Commune'
}, {
'name': 'Peam Aek',
'type': 'Urban Commune'
}, {
'name': 'Prey Chas',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Chiveang Thvang',
'type': 'Urban Commune'
}]
}, {
'name': 'Sangkae District',
'communes': [{
'name': 'Anlong Vil',
'type': 'Urban Commune'
}, {
'name': 'Norea',
'type': 'Urban Commune'
}, {
'name': 'Ta Pon',
'type': 'Urban Commune'
}, {
'name': 'Roka',
'type': 'Urban Commune'
}, {
'name': 'Kampong Preah',
'type': 'Urban Commune'
}, {
'name': 'Kampong Prieng',
'type': 'Urban Commune'
}, {
'name': 'Reang Kesei',
'type': 'Urban Commune'
}, {
'name': 'Ou Dambang Muoy',
'type': 'Urban Commune'
}, {
'name': 'Ou Dambang Pir',
'type': 'Urban Commune'
}, {
'name': 'Voat Ta Muem',
'type': 'Urban Commune'
}]
}, {
'name': 'Phnum Proek District',
'communes': [{
'name': 'Phnum Proek',
'type': 'Urban Commune'
}, {
'name': 'Pech Chenda',
'type': 'Urban Commune'
}, {
'name': 'Chakrei',
'type': 'Urban Commune'
}, {
'name': 'Barang Thleak',
'type': 'Urban Commune'
}, {
'name': 'Ou Rumduol',
'type': 'Urban Commune'
}]
}, {
'name': 'Battambang Municipality',
'communes': [{
'name': 'Tuol Ta Aek',
'type': 'Urban Commune'
}, {
'name': 'Preaek Preah Sdach',
'type': 'Urban Commune'
}, {
'name': 'Rotanak',
'type': 'Urban Commune'
}, {
'name': 'Chamkar Samraong',
'type': 'Urban Commune'
}, {
'name': 'Sla Kaet',
'type': 'Urban Commune'
}, {
'name': 'Kdol Doun Teav',
'type': 'Urban Commune'
}, {
'name': 'Ou Mal',
'type': 'Urban Commune'
}, {
'name': 'Voat Kor',
'type': 'Urban Commune'
}, {
'name': 'Ou Char',
'type': 'Urban Commune'
}, {
'name': 'Svay Pao',
'type': 'Urban Commune'
}]
}, {
'name': 'Moung Ruessei District',
'communes': [{
'name': 'Moung',
'type': 'Urban Commune'
}, {
'name': 'Kear',
'type': 'Urban Commune'
}, {
'name': 'Prey Svay',
'type': 'Urban Commune'
}, {
'name': 'Ruessei Krang',
'type': 'Urban Commune'
}, {
'name': 'Chrey',
'type': 'Urban Commune'
}, {
'name': 'Ta Loas',
'type': 'Urban Commune'
}, {
'name': 'Kakaoh',
'type': 'Urban Commune'
}, {
'name': 'Prey Touch',
'type': 'Urban Commune'
}, {
'name': 'Robas Mongkol',
'type': 'Urban Commune'
}]
}, {
'name': 'Samlout District',
'communes': [{
'name': 'Ta Taok',
'type': 'Urban Commune'
}, {
'name': 'Kampong Lpov',
'type': 'Urban Commune'
}, {
'name': 'Ou Samrel',
'type': 'Urban Commune'
}, {
'name': 'Sung',
'type': 'Urban Commune'
}, {
'name': 'Samlout',
'type': 'Urban Commune'
}, {
'name': 'Mean Chey',
'type': 'Urban Commune'
}, {
'name': 'Ta Sanh',
'type': 'Urban Commune'
}]
}, {
'name': 'Kamrieng District',
'communes': [{
'name': 'Kamrieng',
'type': 'Urban Commune'
}, {
'name': 'Boeng Reang',
'type': 'Urban Commune'
}, {
'name': 'Ou Da',
'type': 'Urban Commune'
}, {
'name': 'Trang',
'type': 'Urban Commune'
}, {
'name': 'Ta Saen',
'type': 'Urban Commune'
}, {
'name': 'Ta Krai',
'type': 'Urban Commune'
}]
}, {
'name': 'Koas Krala District',
'communes': [{
'name': 'Thipakdei',
'type': 'Urban Commune'
}, {
'name': 'Koas Krala',
'type': 'Urban Commune'
}, {
'name': 'Hab',
'type': 'Urban Commune'
}, {
'name': 'Preah Phos',
'type': 'Urban Commune'
}, {
'name': 'Doun Ba',
'type': 'Urban Commune'
}, {
'name': 'Chhnal Moan',
'type': 'Urban Commune'
}]
}, {
'name': 'Rukhak Kiri District',
'communes': [{
'name': 'Prek Chik',
'type': 'Urban Commune'
}, {
'name': 'Prey Tralach',
'type': 'Urban Commune'
}, {
'name': 'Basak',
'type': 'Urban Commune'
}, {
'name': 'Mukh Rea',
'type': 'Urban Commune'
}, {
'name': 'Sdok Provoek',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Kampong Cham Province',
'districtInfos': [{
'name': 'Batheay District',
'communes': [{
'name': 'Batheay',
'type': 'Urban Commune'
}, {
'name': 'Chbar Ampov',
'type': 'Urban Commune'
}, {
'name': 'Chealea',
'type': 'Urban Commune'
}, {
'name': 'Cheung Prey',
'type': 'Urban Commune'
}, {
'name': 'Me Pring',
'type': 'Urban Commune'
}, {
'name': 'Ph\'av',
'type': 'Urban Commune'
}, {
'name': 'Sambour',
'type': 'Urban Commune'
}, {
'name': 'Sandaek',
'type': 'Urban Commune'
}, {
'name': 'Tang Krang',
'type': 'Urban Commune'
}, {
'name': 'Tang Krasang',
'type': 'Urban Commune'
}, {
'name': 'Trab',
'type': 'Urban Commune'
}, {
'name': 'Tumnob',
'type': 'Urban Commune'
}]
}, {
'name': 'Cheung Prey District',
'communes': [{
'name': 'Khnaor Dambang',
'type': 'Urban Commune'
}, {
'name': 'Kouk Rovieng',
'type': 'Urban Commune'
}, {
'name': 'Phdau Chum',
'type': 'Urban Commune'
}, {
'name': 'Prey Char',
'type': 'Urban Commune'
}, {
'name': 'Pring Chrum',
'type': 'Urban Commune'
}, {
'name': 'Sampong Chey',
'type': 'Urban Commune'
}, {
'name': 'Sdaeung Chey',
'type': 'Urban Commune'
}, {
'name': 'Soutip',
'type': 'Urban Commune'
}, {
'name': 'Srama',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Kor',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampong Siem District',
'communes': [{
'name': 'Ampil',
'type': 'Urban Commune'
}, {
'name': 'Hann Chey',
'type': 'Urban Commune'
}, {
'name': 'Kien Chrey',
'type': 'Urban Commune'
}, {
'name': 'Kokor',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Mitt',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Roka',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Samraong',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Tontuem',
'type': 'Urban Commune'
}, {
'name': 'Krala',
'type': 'Urban Commune'
}, {
'name': 'Ou Svay',
'type': 'Urban Commune'
}, {
'name': 'Ro\'any',
'type': 'Urban Commune'
}, {
'name': 'Rumchek',
'type': 'Urban Commune'
}, {
'name': 'Srak',
'type': 'Urban Commune'
}, {
'name': 'Trean',
'type': 'Urban Commune'
}, {
'name': 'Vihear Thum',
'type': 'Urban Commune'
}]
}, {
'name': 'Chamkar Leu District',
'communes': [{
'name': 'Bos Khnaor',
'type': 'Urban Commune'
}, {
'name': 'Chamkar Andoung',
'type': 'Urban Commune'
}, {
'name': 'Cheyyou',
'type': 'Urban Commune'
}, {
'name': 'Lvea Leu',
'type': 'Urban Commune'
}, {
'name': 'Spueu',
'type': 'Urban Commune'
}, {
'name': 'Svay Teab',
'type': 'Urban Commune'
}, {
'name': 'Ta Ong',
'type': 'Urban Commune'
}, {
'name': 'Ta Prok',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampong Cham City',
'communes': [{
'name': 'Boeng Kok',
'type': 'Urban Commune'
}, {
'name': 'Kampong Cham',
'type': 'Urban Commune'
}, {
'name': 'Sambuor Meas',
'type': 'Urban Commune'
}, {
'name': 'Veal Vong',
'type': 'Urban Commune'
}]
}, {
'name': 'Kang Meas District',
'communes': [{
'name': 'Angkor Ban',
'type': 'Urban Commune'
}, {
'name': 'Kang Ta Noeng',
'type': 'Urban Commune'
}, {
'name': 'Khchau',
'type': 'Urban Commune'
}, {
'name': 'Peam Chi Kang',
'type': 'Urban Commune'
}, {
'name': 'Preaek Koy',
'type': 'Urban Commune'
}, {
'name': 'Preaek Krabau',
'type': 'Urban Commune'
}, {
'name': 'Reay Pay',
'type': 'Urban Commune'
}, {
'name': 'Roka ar(រកាអារ)',
'type': 'Urban Commune'
}, {
'name': 'Roka Koy',
'type': 'Urban Commune'
}, {
'name': 'Sdau',
'type': 'Urban Commune'
}, {
'name': 'Sour Kong',
'type': 'Urban Commune'
}]
}, {
'name': 'Prey Chhor District',
'communes': [{
'name': 'Baray',
'type': 'Urban Commune'
}, {
'name': 'Boeng Nay',
'type': 'Urban Commune'
}, {
'name': 'Chrey Vien',
'type': 'Urban Commune'
}, {
'name': 'Khvet Thum',
'type': 'Urban Commune'
}, {
'name': 'Kor',
'type': 'Urban Commune'
}, {
'name': 'Krouch',
'type': 'Urban Commune'
}, {
'name': 'Lvea',
'type': 'Urban Commune'
}, {
'name': 'Mien',
'type': 'Urban Commune'
}, {
'name': 'Prey Chhor',
'type': 'Urban Commune'
}, {
'name': 'Sour Saen',
'type': 'Urban Commune'
}, {
'name': 'Samraong',
'type': 'Urban Commune'
}, {
'name': 'Srangae',
'type': 'Urban Commune'
}, {
'name': 'Thma Pun',
'type': 'Urban Commune'
}, {
'name': 'Tong Rong',
'type': 'Urban Commune'
}, {
'name': 'Trapeang',
'type': 'Urban Commune'
}]
}, {
'name': 'Srey Santhor District',
'communes': [{
'name': 'Baray',
'type': 'Urban Commune'
}, {
'name': 'Chi Bal',
'type': 'Urban Commune'
}, {
'name': 'Khnar Sa',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Andaet',
'type': 'Urban Commune'
}, {
'name': 'Mean Chey',
'type': 'Urban Commune'
}, {
'name': 'Pteah Kandal',
'type': 'Urban Commune'
}, {
'name': 'Pram Yam',
'type': 'Urban Commune'
}, {
'name': 'Preaek Dambouk',
'type': 'Urban Commune'
}, {
'name': 'Preaek Pou',
'type': 'Urban Commune'
}, {
'name': 'Preaek Rumdeng',
'type': 'Urban Commune'
}, {
'name': 'Ruessei Srok',
'type': 'Urban Commune'
}, {
'name': 'Svay Pou',
'type': 'Urban Commune'
}, {
'name': 'Svay Sach Phnum',
'type': 'Urban Commune'
}, {
'name': 'Tong Tralach',
'type': 'Urban Commune'
}]
}, {
'name': 'Stueng Trang District',
'communes': [{
'name': 'Areaks Tnaot',
'type': 'Urban Commune'
}, {
'name': 'Dang Kdar',
'type': 'Urban Commune'
}, {
'name': 'Khpob Ta Nguon',
'type': 'Urban Commune'
}, {
'name': 'Me Sar Chrey',
'type': 'Urban Commune'
}, {
'name': 'Ou Mlu',
'type': 'Urban Commune'
}, {
'name': 'Peam Kaoh Sna',
'type': 'Urban Commune'
}, {
'name': 'Preah Andoung',
'type': 'Urban Commune'
}, {
'name': 'Preaek Bak',
'type': 'Urban Commune'
}, {
'name': 'Preaek Kak',
'type': 'Urban Commune'
}, {
'name': 'Soupheas',
'type': 'Urban Commune'
}, {
'name': 'Tuol Preah Khleang',
'type': 'Urban Commune'
}, {
'name': 'Tuol Sambuor',
'type': 'Urban Commune'
}]
}, {
'name': 'Koh Sotin District',
'communes': [{
'name': 'Kampong Reab',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Soutin',
'type': 'Urban Commune'
}, {
'name': 'Lve',
'type': 'Urban Commune'
}, {
'name': 'Moha Leaph',
'type': 'Urban Commune'
}, {
'name': 'Moha Khnhoung',
'type': 'Urban Commune'
}, {
'name': 'Peam Prathnuoh',
'type': 'Urban Commune'
}, {
'name': 'Pongro',
'type': 'Urban Commune'
}, {
'name': 'Preaek Ta Nong',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Kampong Chhnang Province',
'districtInfos': [{
'name': 'Baribour District',
'communes': [{
'name': 'Anhchanh Rung',
'type': 'Urban Commune'
}, {
'name': 'Chhnok Tru',
'type': 'Urban Commune'
}, {
'name': 'Chak',
'type': 'Urban Commune'
}, {
'name': 'Khon Rang',
'type': 'Urban Commune'
}, {
'name': 'Kampong Preah Kokir',
'type': 'Urban Commune'
}, {
'name': 'Melum',
'type': 'Urban Commune'
}, {
'name': 'Phsar',
'type': 'Urban Commune'
}, {
'name': 'Pech Changvar',
'type': 'Urban Commune'
}, {
'name': 'Popel',
'type': 'Urban Commune'
}, {
'name': 'Ponley',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Chan',
'type': 'Urban Commune'
}]
}, {
'name': 'Chol Kiri District',
'communes': [{
'name': 'Chol Sarg',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Thkov',
'type': 'Urban Commune'
}, {
'name': 'Kampong Os',
'type': 'Urban Commune'
}, {
'name': 'Peam Chhkaok',
'type': 'Urban Commune'
}, {
'name': 'Prey Kri',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampong Chhnang District',
'communes': [{
'name': 'Phsar Chhnang',
'type': 'Urban Commune'
}, {
'name': 'Kampong Chhnang',
'type': 'Urban Commune'
}, {
'name': 'Ph\'er',
'type': 'Urban Commune'
}, {
'name': 'Khsam',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampong Leaeng District',
'communes': [{
'name': 'Chranouk',
'type': 'Urban Commune'
}, {
'name': 'Dar',
'type': 'Urban Commune'
}, {
'name': 'Kampong Hau',
'type': 'Urban Commune'
}, {
'name': 'Phlov Tuk',
'type': 'Urban Commune'
}, {
'name': 'Pou',
'type': 'Urban Commune'
}, {
'name': 'Pralay Meas',
'type': 'Urban Commune'
}, {
'name': 'Samraong Saen',
'type': 'Urban Commune'
}, {
'name': 'Svay Rumpear',
'type': 'Urban Commune'
}, {
'name': 'Trangel',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampong Tralach District',
'communes': [{
'name': 'Ampil Tuek',
'type': 'Urban Commune'
}, {
'name': 'Chhuk Sa',
'type': 'Urban Commune'
}, {
'name': 'Chres',
'type': 'Urban Commune'
}, {
'name': 'Kampong Tralach',
'type': 'Urban Commune'
}, {
'name': 'Longveaek',
'type': 'Urban Commune'
}, {
'name': 'Ou Ruessei',
'type': 'Urban Commune'
}, {
'name': 'Peani',
'type': 'Urban Commune'
}, {
'name': 'Saeb',
'type': 'Urban Commune'
}, {
'name': 'Ta Ches',
'type': 'Urban Commune'
}, {
'name': 'Thma Edth',
'type': 'Urban Commune'
}]
}, {
'name': 'Rolea B\'ier District',
'communes': [{
'name': 'Andoung Snay',
'type': 'Urban Commune'
}, {
'name': 'Banteay Preal',
'type': 'Urban Commune'
}, {
'name': 'Cheung Kreav',
'type': 'Urban Commune'
}, {
'name': 'Chrey Bak',
'type': 'Urban Commune'
}, {
'name': 'Kouk Banteay',
'type': 'Urban Commune'
}, {
'name': 'Krang Leav',
'type': 'Urban Commune'
}, {
'name': 'Pongro',
'type': 'Urban Commune'
}, {
'name': 'Prasneb',
'type': 'Urban Commune'
}, {
'name': 'Prey Mul',
'type': 'Urban Commune'
}, {
'name': 'Rolea B\'ier',
'type': 'Urban Commune'
}, {
'name': 'Srae Thmei',
'type': 'Urban Commune'
}, {
'name': 'Svay Chrum',
'type': 'Urban Commune'
}, {
'name': 'Tuek Hout',
'type': 'Urban Commune'
}]
}, {
'name': 'Sameakki District',
'communes': [{
'name': 'Chhean Laeung',
'type': 'Urban Commune'
}, {
'name': 'Khnar Chhmar',
'type': 'Urban Commune'
}, {
'name': 'Krang Lvea',
'type': 'Urban Commune'
}, {
'name': 'Peam',
'type': 'Urban Commune'
}, {
'name': 'Sedthei',
'type': 'Urban Commune'
}, {
'name': 'Svay',
'type': 'Urban Commune'
}, {
'name': 'Svay Chuk',
'type': 'Urban Commune'
}, {
'name': 'Tbaeng Khpos',
'type': 'Urban Commune'
}, {
'name': 'Thlok Vien',
'type': 'Urban Commune'
}]
}, {
'name': 'Tuek Phos District',
'communes': [{
'name': 'Akphivoadth',
'type': 'Urban Commune'
}, {
'name': 'Chieb',
'type': 'Urban Commune'
}, {
'name': 'Chaong Maong',
'type': 'Urban Commune'
}, {
'name': 'Kbal Tuek',
'type': 'Urban Commune'
}, {
'name': 'Khlong Popok',
'type': 'Urban Commune'
}, {
'name': 'Krang Skear',
'type': 'Urban Commune'
}, {
'name': 'Tang Krasang',
'type': 'Urban Commune'
}, {
'name': 'Toul Khpos',
'type': 'Urban Commune'
}, {
'name': 'Kdol Saen Chey',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Kampong Speu Province',
'districtInfos': [{
'name': 'Basedth District',
'communes': [{
'name': 'Basedth',
'type': 'Urban Commune'
}, {
'name': 'Kat Phluk',
'type': 'Urban Commune'
}, {
'name': 'Nitean',
'type': 'Urban Commune'
}, {
'name': 'Pheakdei',
'type': 'Urban Commune'
}, {
'name': 'Pheari Mean Chey',
'type': 'Urban Commune'
}, {
'name': 'Phong',
'type': 'Urban Commune'
}, {
'name': 'Pou Angkrang',
'type': 'Urban Commune'
}, {
'name': 'Pou Chamraeun',
'type': 'Urban Commune'
}, {
'name': 'Pou Mreal',
'type': 'Urban Commune'
}, {
'name': 'Svay Chacheb',
'type': 'Urban Commune'
}, {
'name': 'Tuol Ampil',
'type': 'Urban Commune'
}, {
'name': 'Tuol Sala',
'type': 'Urban Commune'
}, {
'name': 'Kak',
'type': 'Urban Commune'
}, {
'name': 'Svay Rumpea',
'type': 'Urban Commune'
}, {
'name': 'Preah Khae',
'type': 'Urban Commune'
}]
}, {
'name': 'Chbar Mon District',
'communes': [{
'name': 'Chbar Mon',
'type': 'Urban Commune'
}, {
'name': 'Kandaol Dom',
'type': 'Urban Commune'
}, {
'name': 'Roka Thum',
'type': 'Urban Commune'
}, {
'name': 'Sopoar Tep',
'type': 'Urban Commune'
}, {
'name': 'Svay Kravan',
'type': 'Urban Commune'
}]
}, {
'name': 'Kong Pisei District',
'communes': [{
'name': 'Angk Popel',
'type': 'Urban Commune'
}, {
'name': 'Chongruk',
'type': 'Urban Commune'
}, {
'name': 'Moha Ruessei',
'type': 'Urban Commune'
}, {
'name': 'Pechr Muni',
'type': 'Urban Commune'
}, {
'name': 'Preah Nipean',
'type': 'Urban Commune'
}, {
'name': 'Prey Nheat',
'type': 'Urban Commune'
}, {
'name': 'Prey Vihear',
'type': 'Urban Commune'
}, {
'name': 'Roka Kaoh',
'type': 'Urban Commune'
}, {
'name': 'Sdok',
'type': 'Urban Commune'
}, {
'name': 'Snam Krapeu',
'type': 'Urban Commune'
}, {
'name': 'Srang',
'type': 'Urban Commune'
}, {
'name': 'Tuek L\'ak',
'type': 'Urban Commune'
}, {
'name': 'Veal',
'type': 'Urban Commune'
}]
}, {
'name': 'Aoral District',
'communes': [{
'name': 'Haong Samnam',
'type': 'Urban Commune'
}, {
'name': 'Reaksmei Sameakki',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Chour',
'type': 'Urban Commune'
}, {
'name': 'Sangkae Satob',
'type': 'Urban Commune'
}, {
'name': 'Ta Sal',
'type': 'Urban Commune'
}]
}, {
'name': 'Odongk District',
'communes': [{
'name': 'Chant Saen ',
'type': 'Urban Commune'
}, {
'name': 'Cheung Roas ',
'type': 'Urban Commune'
}, {
'name': 'Chumpu Proeks ',
'type': 'Urban Commune'
}, {
'name': 'Khsem Khsan ',
'type': 'Urban Commune'
}, {
'name': 'Krang Chek ',
'type': 'Urban Commune'
}, {
'name': 'Mean Chey ',
'type': 'Urban Commune'
}, {
'name': 'Preah Srae ',
'type': 'Urban Commune'
}, {
'name': 'Prey Krasang ',
'type': 'Urban Commune'
}, {
'name': 'Trach Tong ',
'type': 'Urban Commune'
}, {
'name': 'Veal Pung ',
'type': 'Urban Commune'
}, {
'name': 'Veang Chas ',
'type': 'Urban Commune'
}, {
'name': 'Yutth Sameakki ',
'type': 'Urban Commune'
}, {
'name': 'Damnak Reang ',
'type': 'Urban Commune'
}, {
'name': 'Peang Lvea ',
'type': 'Urban Commune'
}, {
'name': 'Phnum Touch ',
'type': 'Urban Commune'
}]
}, {
'name': 'Phnom Sruoch District',
'communes': [{
'name': 'Chambak',
'type': 'Urban Commune'
}, {
'name': 'Choam Sangkae',
'type': 'Urban Commune'
}, {
'name': 'Dambouk Rung',
'type': 'Urban Commune'
}, {
'name': 'Kiri Voan',
'type': 'Urban Commune'
}, {
'name': 'Krang Dei Vay',
'type': 'Urban Commune'
}, {
'name': 'Moha Sang',
'type': 'Urban Commune'
}, {
'name': 'Ou',
'type': 'Urban Commune'
}, {
'name': 'Prey Rumduol',
'type': 'Urban Commune'
}, {
'name': 'Prey Kmeng',
'type': 'Urban Commune'
}, {
'name': 'Tang Samraong',
'type': 'Urban Commune'
}, {
'name': 'Tang Sya',
'type': 'Urban Commune'
}, {
'name': 'Traeng Trayueng',
'type': 'Urban Commune'
}]
}, {
'name': 'Samraong Tong District',
'communes': [{
'name': 'Roleang Chak',
'type': 'Urban Commune'
}, {
'name': 'Kahaeng',
'type': 'Urban Commune'
}, {
'name': 'Khtum Krang',
'type': 'Urban Commune'
}, {
'name': 'Krang Ampil',
'type': 'Urban Commune'
}, {
'name': 'Pneay',
'type': 'Urban Commune'
}, {
'name': 'Roleang Kreul',
'type': 'Urban Commune'
}, {
'name': 'Samraong Tong',
'type': 'Urban Commune'
}, {
'name': 'Sambour',
'type': 'Urban Commune'
}, {
'name': 'Saen Dei',
'type': 'Urban Commune'
}, {
'name': 'Skuh',
'type': 'Urban Commune'
}, {
'name': 'Tang Krouch',
'type': 'Urban Commune'
}, {
'name': 'Thommoda Ar',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Kong',
'type': 'Urban Commune'
}, {
'name': 'Tumpoar Meas',
'type': 'Urban Commune'
}, {
'name': 'Voa Sa',
'type': 'Urban Commune'
}]
}, {
'name': 'Thpong District',
'communes': [{
'name': 'Amleang',
'type': 'Urban Commune'
}, {
'name': 'Monourom',
'type': 'Urban Commune'
}, {
'name': 'Prambei Mom',
'type': 'Urban Commune'
}, {
'name': 'Rung Roeang',
'type': 'Urban Commune'
}, {
'name': 'Toap Mean',
'type': 'Urban Commune'
}, {
'name': 'Veal Pon',
'type': 'Urban Commune'
}, {
'name': 'Yea Angk',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Kampong Thom Province',
'districtInfos': [{
'name': 'Baray District',
'communes': [{
'name': 'Bak Sna',
'type': 'Urban Commune'
}, {
'name': 'Balangk',
'type': 'Urban Commune'
}, {
'name': 'Baray',
'type': 'Urban Commune'
}, {
'name': 'Beung',
'type': 'Urban Commune'
}, {
'name': 'Cheungdeung',
'type': 'Urban Commune'
}, {
'name': 'Chroneang',
'type': 'Urban Commune'
}, {
'name': 'Chhouk Ksach',
'type': 'Urban Commune'
}, {
'name': 'Chong Dong',
'type': 'Urban Commune'
}, {
'name': 'Chrolorng',
'type': 'Urban Commune'
}, {
'name': 'Koki Thum',
'type': 'Urban Commune'
}, {
'name': 'Krova',
'type': 'Urban Commune'
}, {
'name': 'Andong Pou',
'type': 'Urban Commune'
}, {
'name': 'Pongro',
'type': 'Urban Commune'
}, {
'name': 'So Yourng',
'type': 'Urban Commune'
}, {
'name': 'Srolao',
'type': 'Urban Commune'
}, {
'name': 'Svay Phleung',
'type': 'Urban Commune'
}, {
'name': 'Thnoat Chum',
'type': 'Urban Commune'
}, {
'name': 'Treal',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampong Svay District',
'communes': [{
'name': 'Chey',
'type': 'Urban Commune'
}, {
'name': 'Domrei Slab',
'type': 'Urban Commune'
}, {
'name': 'Kampong Kou',
'type': 'Urban Commune'
}, {
'name': 'Kampong Svay',
'type': 'Urban Commune'
}, {
'name': 'Ni Pich',
'type': 'Urban Commune'
}, {
'name': 'Phat Sanday',
'type': 'Urban Commune'
}, {
'name': 'Sann Kor',
'type': 'Urban Commune'
}, {
'name': 'Tbaeng',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Russei',
'type': 'Urban Commune'
}, {
'name': 'Kdei Dong',
'type': 'Urban Commune'
}, {
'name': 'Prey Kuy',
'type': 'Urban Commune'
}]
}, {
'name': 'Stueng Saen District',
'communes': [{
'name': 'Damrei Choan Khla',
'type': 'Urban Commune'
}, {
'name': 'Kampong Thum',
'type': 'Urban Commune'
}, {
'name': 'Kampong Roteh',
'type': 'Urban Commune'
}, {
'name': 'Ou Kanthor',
'type': 'Urban Commune'
}, {
'name': 'Kampong Krabau',
'type': 'Urban Commune'
}, {
'name': 'Prey Ta Hu',
'type': 'Urban Commune'
}, {
'name': 'Achar Leak',
'type': 'Urban Commune'
}, {
'name': 'Srayov',
'type': 'Urban Commune'
}]
}, {
'name': 'Prasat Balangk District',
'communes': [{
'name': 'Doung',
'type': 'Urban Commune'
}, {
'name': 'Kraya',
'type': 'Urban Commune'
}, {
'name': 'Phan Nheum',
'type': 'Urban Commune'
}, {
'name': 'Sakream',
'type': 'Urban Commune'
}, {
'name': 'Sala Visai',
'type': 'Urban Commune'
}, {
'name': 'Sameakki',
'type': 'Urban Commune'
}, {
'name': 'Tuol Kreul',
'type': 'Urban Commune'
}]
}, {
'name': 'Prasat Sambour District',
'communes': [{
'name': 'Chouk',
'type': 'Urban Commune'
}, {
'name': 'Koul',
'type': 'Urban Commune'
}, {
'name': 'Sambour',
'type': 'Urban Commune'
}, {
'name': 'Sroeung',
'type': 'Urban Commune'
}, {
'name': 'Taing Krasao',
'type': 'Urban Commune'
}]
}, {
'name': 'Sandan District',
'communes': [{
'name': 'Chheu Teal',
'type': 'Urban Commune'
}, {
'name': 'Dang Kambet',
'type': 'Urban Commune'
}, {
'name': 'Klaeng',
'type': 'Urban Commune'
}, {
'name': 'Mean Rith',
'type': 'Urban Commune'
}, {
'name': 'Mean Chey',
'type': 'Urban Commune'
}, {
'name': 'Ngan',
'type': 'Urban Commune'
}, {
'name': 'Sandan',
'type': 'Urban Commune'
}, {
'name': 'Sochet',
'type': 'Urban Commune'
}, {
'name': 'Tum Ring',
'type': 'Urban Commune'
}]
}, {
'name': 'Santuk District',
'communes': [{
'name': 'Boeng Lvea',
'type': 'Urban Commune'
}, {
'name': 'Chroab',
'type': 'Urban Commune'
}, {
'name': 'Kampong Thma',
'type': 'Urban Commune'
}, {
'name': 'Kakaoh',
'type': 'Urban Commune'
}, {
'name': 'Kraya',
'type': 'Urban Commune'
}, {
'name': 'Pnov',
'type': 'Urban Commune'
}, {
'name': 'Prasat',
'type': 'Urban Commune'
}, {
'name': 'Tang Krasang',
'type': 'Urban Commune'
}, {
'name': 'Ti Pou',
'type': 'Urban Commune'
}, {
'name': 'Tboung Krapeu',
'type': 'Urban Commune'
}]
}, {
'name': 'Stoung District',
'communes': [{
'name': 'Banteay Stoung',
'type': 'Urban Commune'
}, {
'name': 'Chamna Kraom',
'type': 'Urban Commune'
}, {
'name': 'Chamna Leu',
'type': 'Urban Commune'
}, {
'name': 'Kampong Chen Cheung',
'type': 'Urban Commune'
}, {
'name': 'Kampong Chen Tboung',
'type': 'Urban Commune'
}, {
'name': 'Msa Krang',
'type': 'Urban Commune'
}, {
'name': 'Peam Bang',
'type': 'Urban Commune'
}, {
'name': 'Popok',
'type': 'Urban Commune'
}, {
'name': 'Pralay',
'type': 'Urban Commune'
}, {
'name': 'Rung Roeang',
'type': 'Urban Commune'
}, {
'name': 'Samprouch',
'type': 'Urban Commune'
}, {
'name': 'Preah Damrei',
'type': 'Urban Commune'
}, {
'name': 'Trea',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Kampot Province',
'districtInfos': [{
'name': 'Angkor Chey District',
'communes': [{
'name': 'Angk Phnom Toch',
'type': 'Urban Commune'
}, {
'name': 'Angkor Chey',
'type': 'Urban Commune'
}, {
'name': 'Chompei',
'type': 'Urban Commune'
}, {
'name': 'Dombok Khpous',
'type': 'Urban Commune'
}, {
'name': 'Dankourm',
'type': 'Urban Commune'
}, {
'name': 'Deum Dong',
'type': 'Urban Commune'
}, {
'name': 'Mrourm',
'type': 'Urban Commune'
}, {
'name': 'Phnom Kong',
'type': 'Urban Commune'
}, {
'name': 'Brophnom',
'type': 'Urban Commune'
}, {
'name': 'Somlanh',
'type': 'Urban Commune'
}, {
'name': 'Tani',
'type': 'Urban Commune'
}]
}, {
'name': 'Banteay Meas District',
'communes': [{
'name': 'Banteay Meas Khang Kert',
'type': 'Urban Commune'
}, {
'name': 'Banteay Meas Khang Lech',
'type': 'Urban Commune'
}, {
'name': 'Prey Tonle',
'type': 'Urban Commune'
}, {
'name': 'Somrorng Krom',
'type': 'Urban Commune'
}, {
'name': 'Somrorng Leu',
'type': 'Urban Commune'
}, {
'name': 'Sdechkong Khang Cheung',
'type': 'Urban Commune'
}, {
'name': 'Sdechkong Khang Lech',
'type': 'Urban Commune'
}, {
'name': 'Sdechkong Khang Tbong',
'type': 'Urban Commune'
}, {
'name': 'Tnoat Chong Srorng',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Sala Khang Kert',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Sala Khang Lech',
'type': 'Urban Commune'
}, {
'name': 'Touk Meas Khang Kert',
'type': 'Urban Commune'
}, {
'name': 'Touk Meas Khang Lech',
'type': 'Urban Commune'
}, {
'name': 'Vat Angk Khang Cheung',
'type': 'Urban Commune'
}, {
'name': 'Vat Angk Khang Tbong',
'type': 'Urban Commune'
}]
}, {
'name': 'Chhuk District',
'communes': [{
'name': 'Baneav',
'type': 'Urban Commune'
}, {
'name': 'Takaen',
'type': 'Urban Commune'
}, {
'name': 'Beung Nimol',
'type': 'Urban Commune'
}, {
'name': 'Chhouk',
'type': 'Urban Commune'
}, {
'name': 'Daun Yoy',
'type': 'Urban Commune'
}, {
'name': 'Krang Sbov',
'type': 'Urban Commune'
}, {
'name': 'Krang Snay',
'type': 'Urban Commune'
}, {
'name': 'Lbeuk',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Phlearng',
'type': 'Urban Commune'
}, {
'name': 'Meanchey',
'type': 'Urban Commune'
}, {
'name': 'Noreay',
'type': 'Urban Commune'
}, {
'name': 'Satv Porng',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Bei',
'type': 'Urban Commune'
}, {
'name': 'Tromaeng',
'type': 'Urban Commune'
}, {
'name': 'Decho Aphivat',
'type': 'Urban Commune'
}]
}, {
'name': 'Chum Kiri District',
'communes': [{
'name': 'Chres',
'type': 'Urban Commune'
}, {
'name': 'Chompouvornt',
'type': 'Urban Commune'
}, {
'name': 'Snay Anhchit',
'type': 'Urban Commune'
}, {
'name': 'Srae Chaeng',
'type': 'Urban Commune'
}, {
'name': 'Srae Khnong',
'type': 'Urban Commune'
}, {
'name': 'Srae Somroang',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Reang',
'type': 'Urban Commune'
}]
}, {
'name': 'Dang Tong District',
'communes': [{
'name': 'Domnak Sokrom',
'type': 'Urban Commune'
}, {
'name': 'Dorng Tong',
'type': 'Urban Commune'
}, {
'name': 'Kcheay Khang Cheung',
'type': 'Urban Commune'
}, {
'name': 'Kcheay Khang Tbong',
'type': 'Urban Commune'
}, {
'name': 'Meanrith',
'type': 'Urban Commune'
}, {
'name': 'Sraechea Khang Cheung',
'type': 'Urban Commune'
}, {
'name': 'Sraechea Khang Tbong',
'type': 'Urban Commune'
}, {
'name': 'Totung',
'type': 'Urban Commune'
}, {
'name': 'Angk Romeas',
'type': 'Urban Commune'
}, {
'name': 'La\'ang',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampong Trach District',
'communes': [{
'name': 'Beung Sala Khang Cheung',
'type': 'Urban Commune'
}, {
'name': 'Beung Sala Khang Tbong',
'type': 'Urban Commune'
}, {
'name': 'Domnak Kantout Khan Cheung',
'type': 'Urban Commune'
}, {
'name': 'Domnak Kantout Khan Tbong',
'type': 'Urban Commune'
}, {
'name': 'Kampong Trach Khang Kert',
'type': 'Urban Commune'
}, {
'name': 'Kampong Trach Khang Lech',
'type': 'Urban Commune'
}, {
'name': 'Brasat Phnom Kchorng',
'type': 'Urban Commune'
}, {
'name': 'Phnom Brasat',
'type': 'Urban Commune'
}, {
'name': 'Angk Sorphi',
'type': 'Urban Commune'
}, {
'name': 'Praek Kreus',
'type': 'Urban Commune'
}, {
'name': 'Russei Srok Khang Kert',
'type': 'Urban Commune'
}, {
'name': 'Russei Srok Khang Lech',
'type': 'Urban Commune'
}, {
'name': 'Svay Torng Khang Cheung',
'type': 'Urban Commune'
}, {
'name': 'Svay Torng Khang Tbong',
'type': 'Urban Commune'
}]
}, {
'name': 'Tuek Chhou District',
'communes': [{
'name': 'Beung Touk',
'type': 'Urban Commune'
}, {
'name': 'Chum Kreal',
'type': 'Urban Commune'
}, {
'name': 'Kampong Kraeng',
'type': 'Urban Commune'
}, {
'name': 'Kampong Rorng',
'type': 'Urban Commune'
}, {
'name': 'Kandoal',
'type': 'Urban Commune'
}, {
'name': 'Koh Toch',
'type': 'Urban Commune'
}, {
'name': 'Kon Sat',
'type': 'Urban Commune'
}, {
'name': 'Mak Brang',
'type': 'Urban Commune'
}, {
'name': 'Praek Tnoat',
'type': 'Urban Commune'
}, {
'name': 'Prey Khmum',
'type': 'Urban Commune'
}, {
'name': 'Prey Tnorng',
'type': 'Urban Commune'
}, {
'name': 'Stueng Keo',
'type': 'Urban Commune'
}, {
'name': 'Thmei',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Pring',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Sangke',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Thom',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampot District',
'communes': [{
'name': 'Kampong Kandal',
'type': 'Urban Commune'
}, {
'name': 'Kampong Bay',
'type': 'Urban Commune'
}, {
'name': 'Andong Khmer',
'type': 'Urban Commune'
}, {
'name': 'Treuy Koh',
'type': 'Urban Commune'
}, {
'name': 'Krang Ampil',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Kandal Province',
'districtInfos': [{
'name': 'Kandal Stueng District',
'communes': [{
'name': 'Ampov Prey',
'type': 'Urban Commune'
}, {
'name': 'Anlong Romeat',
'type': 'Urban Commune'
}, {
'name': 'Bar Kou',
'type': 'Urban Commune'
}, {
'name': 'Beung Khchang',
'type': 'Urban Commune'
}, {
'name': 'Cheung Keub',
'type': 'Urban Commune'
}, {
'name': 'Deum Reus',
'type': 'Urban Commune'
}, {
'name': 'Kandaok',
'type': 'Urban Commune'
}, {
'name': 'Thmei',
'type': 'Urban Commune'
}, {
'name': 'Koak Trob',
'type': 'Urban Commune'
}, {
'name': 'Preah Puth',
'type': 'Urban Commune'
}, {
'name': 'Praek Roka',
'type': 'Urban Commune'
}, {
'name': 'Praek Slaeng',
'type': 'Urban Commune'
}, {
'name': 'Roka',
'type': 'Urban Commune'
}, {
'name': 'Roleang Kaen',
'type': 'Urban Commune'
}, {
'name': 'Siem Reap',
'type': 'Urban Commune'
}, {
'name': 'Tbaeng',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Vaeng',
'type': 'Urban Commune'
}, {
'name': 'Trea',
'type': 'Urban Commune'
}]
}, {
'name': 'Kien Svay District',
'communes': [{
'name': 'Banteay Daek',
'type': 'Urban Commune'
}, {
'name': 'Chheu Teal',
'type': 'Urban Commune'
}, {
'name': 'Dei Edth',
'type': 'Urban Commune'
}, {
'name': 'Kampong Svay',
'type': 'Urban Commune'
}, {
'name': 'Kbal Kaoh',
'type': 'Urban Commune'
}, {
'name': 'Kokir',
'type': 'Urban Commune'
}, {
'name': 'Kokir Thum',
'type': 'Urban Commune'
}, {
'name': 'Preaek Aeng',
'type': 'Urban Commune'
}, {
'name': 'Phum Thum',
'type': 'Urban Commune'
}, {
'name': 'Preaek Thmei',
'type': 'Urban Commune'
}, {
'name': 'Samraong Thum',
'type': 'Urban Commune'
}, {
'name': 'Veal Sbov',
'type': 'Urban Commune'
}]
}, {
'name': 'Khsach Kandal District',
'communes': [{
'name': 'Bak Dav',
'type': 'Urban Commune'
}, {
'name': 'Chey Thom',
'type': 'Urban Commune'
}, {
'name': 'Kampong Chomlorng',
'type': 'Urban Commune'
}, {
'name': 'Koh Choram',
'type': 'Urban Commune'
}, {
'name': 'Koh Ouhna Tei',
'type': 'Urban Commune'
}, {
'name': 'Preah Brosob',
'type': 'Urban Commune'
}, {
'name': 'Praek Ampel',
'type': 'Urban Commune'
}, {
'name': 'Praek Loung',
'type': 'Urban Commune'
}, {
'name': 'Praek Takov',
'type': 'Urban Commune'
}, {
'name': 'Praek Tameak',
'type': 'Urban Commune'
}, {
'name': 'Puk Russei',
'type': 'Urban Commune'
}, {
'name': 'Roka Chonling',
'type': 'Urban Commune'
}, {
'name': 'Sonlong',
'type': 'Urban Commune'
}, {
'name': 'Sithor',
'type': 'Urban Commune'
}, {
'name': 'Svay Chrum',
'type': 'Urban Commune'
}, {
'name': 'Svay Romeat',
'type': 'Urban Commune'
}, {
'name': 'Ta Aek',
'type': 'Urban Commune'
}, {
'name': 'Vihear Sour',
'type': 'Urban Commune'
}]
}, {
'name': 'Koh Thum District',
'communes': [{
'name': 'Chheu Khmao',
'type': 'Urban Commune'
}, {
'name': 'Chroy Takeo',
'type': 'Urban Commune'
}, {
'name': 'Kampong Kong',
'type': 'Urban Commune'
}, {
'name': 'Koh Thom Ka',
'type': 'Urban Commune'
}, {
'name': 'Koh Thom Kha',
'type': 'Urban Commune'
}, {
'name': 'Leuk Daek',
'type': 'Urban Commune'
}, {
'name': 'Pou Ban',
'type': 'Urban Commune'
}, {
'name': 'Praek Chrey',
'type': 'Urban Commune'
}, {
'name': 'Praek Thmei',
'type': 'Urban Commune'
}, {
'name': 'Praek Sdei',
'type': 'Urban Commune'
}, {
'name': 'Sampov Poun',
'type': 'Urban Commune'
}]
}, {
'name': 'Leuk Daek District',
'communes': [{
'name': 'Kampong Phnom',
'type': 'Urban Commune'
}, {
'name': 'Ka\'om Samnor',
'type': 'Urban Commune'
}, {
'name': 'Kpob Ateav',
'type': 'Urban Commune'
}, {
'name': 'Peam Reang',
'type': 'Urban Commune'
}, {
'name': 'Praek Dach',
'type': 'Urban Commune'
}, {
'name': 'Praek Tonlob',
'type': 'Urban Commune'
}, {
'name': 'Sandar',
'type': 'Urban Commune'
}]
}, {
'name': 'Lvea Aem District',
'communes': [{
'name': 'Ariyaksatr',
'type': 'Urban Commune'
}, {
'name': 'Barong',
'type': 'Urban Commune'
}, {
'name': 'Beung Krum',
'type': 'Urban Commune'
}, {
'name': 'Koh Keo',
'type': 'Urban Commune'
}, {
'name': 'Koh Reah',
'type': 'Urban Commune'
}, {
'name': 'Lvea Sor',
'type': 'Urban Commune'
}, {
'name': 'Peam Okhna Ong',
'type': 'Urban Commune'
}, {
'name': 'Phum Thom',
'type': 'Urban Commune'
}, {
'name': 'Praek Kmeng',
'type': 'Urban Commune'
}, {
'name': 'Praek Rey',
'type': 'Urban Commune'
}, {
'name': 'Praek Russei',
'type': 'Urban Commune'
}, {
'name': 'Sombour',
'type': 'Urban Commune'
}, {
'name': 'Sarikakeo',
'type': 'Urban Commune'
}, {
'name': 'Thma Kor',
'type': 'Urban Commune'
}, {
'name': 'Teuk Khleang',
'type': 'Urban Commune'
}]
}, {
'name': 'Mukh Kamphool District',
'communes': [{
'name': 'Bak Khaeng',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Dach',
'type': 'Urban Commune'
}, {
'name': 'Preaek Anhchanh',
'type': 'Urban Commune'
}, {
'name': 'Preaek Dambang',
'type': 'Urban Commune'
}, {
'name': 'Roka Kaong Muoy',
'type': 'Urban Commune'
}, {
'name': 'Roka Kaong Pir',
'type': 'Urban Commune'
}, {
'name': 'Ruessei Chrouy',
'type': 'Urban Commune'
}, {
'name': 'Sambuor Meas',
'type': 'Urban Commune'
}, {
'name': 'Svay Ampear',
'type': 'Urban Commune'
}]
}, {
'name': 'Angk Snuol District',
'communes': [{
'name': 'Baek Chan',
'type': 'Urban Commune'
}, {
'name': 'Boeng Thum',
'type': 'Urban Commune'
}, {
'name': 'Chhak Chheu Neang',
'type': 'Urban Commune'
}, {
'name': 'Damnak Ampil',
'type': 'Urban Commune'
}, {
'name': 'Kamboul',
'type': 'Urban Commune'
}, {
'name': 'Kantaok',
'type': 'Urban Commune'
}, {
'name': 'Krang Mkak',
'type': 'Urban Commune'
}, {
'name': 'Lumhach',
'type': 'Urban Commune'
}, {
'name': 'Mkak',
'type': 'Urban Commune'
}, {
'name': 'Ovlaok',
'type': 'Urban Commune'
}, {
'name': 'Peuk',
'type': 'Urban Commune'
}, {
'name': 'Ponsang',
'type': 'Urban Commune'
}, {
'name': 'Prey Puok',
'type': 'Urban Commune'
}, {
'name': 'Samraong Leu',
'type': 'Urban Commune'
}, {
'name': 'Snao',
'type': 'Urban Commune'
}, {
'name': 'Tuol Prech',
'type': 'Urban Commune'
}]
}, {
'name': 'Ponhea Leu District',
'communes': [{
'name': 'Chhveang ',
'type': 'Urban Commune'
}, {
'name': 'Chrey Loas',
'type': 'Urban Commune'
}, {
'name': 'Kampong Luong',
'type': 'Urban Commune'
}, {
'name': 'Kampong Os',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Chen',
'type': 'Urban Commune'
}, {
'name': 'Phnum Bat',
'type': 'Urban Commune'
}, {
'name': 'Ponhea Lueu',
'type': 'Urban Commune'
}, {
'name': 'Ponhea Pon',
'type': 'Urban Commune'
}, {
'name': 'Preaek Pnov',
'type': 'Urban Commune'
}, {
'name': 'Preaek Ta Teaen',
'type': 'Urban Commune'
}, {
'name': 'Phsar Daek',
'type': 'Urban Commune'
}, {
'name': 'Samraong',
'type': 'Urban Commune'
}, {
'name': 'Tumnob Thum',
'type': 'Urban Commune'
}, {
'name': 'Vihear Luong',
'type': 'Urban Commune'
}]
}, {
'name': 'S\'ang District',
'communes': [{
'name': 'Khpob ',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Khael',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Khsach Tonlea',
'type': 'Urban Commune'
}, {
'name': 'Krang Yov',
'type': 'Urban Commune'
}, {
'name': 'Prasat',
'type': 'Urban Commune'
}, {
'name': 'Preaek Ambel',
'type': 'Urban Commune'
}, {
'name': 'Preaek Koy',
'type': 'Urban Commune'
}, {
'name': 'S\'ang Phnum',
'type': 'Urban Commune'
}, {
'name': 'Svay Prateal',
'type': 'Urban Commune'
}, {
'name': 'Ta Lon',
'type': 'Urban Commune'
}, {
'name': 'Traeuy Sla',
'type': 'Urban Commune'
}, {
'name': 'Tuek Vil',
'type': 'Urban Commune'
}]
}, {
'name': 'Ta Khmau Municipality',
'communes': [{
'name': 'Sangkat Kampong Samnanh',
'type': 'Urban Commune'
}, {
'name': 'Prey Veng',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Takdol',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Takhmao',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Prekhor',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Prek Russey',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Svay Rolum',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Kaoh Anlong Chen',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Setbou',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Roka Khpos',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Koh Kong Province',
'districtInfos': [{
'name': 'Botum Sakor ',
'communes': [{
'name': 'Andong Teuk',
'type': 'Urban Commune'
}, {
'name': 'Kandoal',
'type': 'Urban Commune'
}, {
'name': 'Ta Nuon',
'type': 'Urban Commune'
}, {
'name': 'Thma Sor',
'type': 'Urban Commune'
}]
}, {
'name': 'Kiri Sakor',
'communes': [{
'name': 'Koh Sdech',
'type': 'Urban Commune'
}, {
'name': 'Phnhi Meas',
'type': 'Urban Commune'
}, {
'name': 'Praek Ksach',
'type': 'Urban Commune'
}]
}, {
'name': 'Koh Kong',
'communes': [{
'name': 'Chrouy Pras',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Kapi',
'type': 'Urban Commune'
}, {
'name': 'Ta Tai Kraom',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Rung',
'type': 'Urban Commune'
}]
}, {
'name': 'Khemarak Phoumin Municipality ',
'communes': [{
'name': 'Smach Meanchey',
'type': 'Urban Commune'
}, {
'name': 'Dang Tong',
'type': 'Urban Commune'
}, {
'name': 'Steung Veng',
'type': 'Urban Commune'
}]
}, {
'name': 'Mondol Seima',
'communes': [{
'name': 'Bak Khlang',
'type': 'Urban Commune'
}, {
'name': 'Peam Krasaob',
'type': 'Urban Commune'
}, {
'name': 'Tuol Kokir Leu',
'type': 'Urban Commune'
}]
}, {
'name': 'Srae Ambel',
'communes': [{
'name': 'Beung Preav',
'type': 'Urban Commune'
}, {
'name': 'Chi Kho Krom',
'type': 'Urban Commune'
}, {
'name': 'Chi Kho Leu',
'type': 'Urban Commune'
}, {
'name': 'Chroy Svay',
'type': 'Urban Commune'
}, {
'name': 'Dang Paeng',
'type': 'Urban Commune'
}, {
'name': 'Srae Ambel',
'type': 'Urban Commune'
}]
}, {
'name': 'Thma Bang',
'communes': [{
'name': 'Tatai Leu',
'type': 'Urban Commune'
}, {
'name': 'Brolay',
'type': 'Urban Commune'
}, {
'name': 'Chomnoab',
'type': 'Urban Commune'
}, {
'name': 'Russei Chrum',
'type': 'Urban Commune'
}, {
'name': 'Chi Phat',
'type': 'Urban Commune'
}, {
'name': 'Thma Daun Pouv',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Kratie Province',
'districtInfos': [{
'name': 'Chhlong',
'communes': [{
'name': 'Chhlong',
'type': 'Urban Commune'
}, {
'name': 'Domrei Phong',
'type': 'Urban Commune'
}, {
'name': 'Han Chey',
'type': 'Urban Commune'
}, {
'name': 'Kampong Domrei',
'type': 'Urban Commune'
}, {
'name': 'Kanhchor',
'type': 'Urban Commune'
}, {
'name': 'Ksach Andaet',
'type': 'Urban Commune'
}, {
'name': 'Praek Samann',
'type': 'Urban Commune'
}, {
'name': 'Pongro',
'type': 'Urban Commune'
}]
}, {
'name': 'Chetr Borei ',
'communes': [{
'name': 'Bos Leav',
'type': 'Urban Commune'
}, {
'name': 'Changkrang',
'type': 'Urban Commune'
}, {
'name': 'Dar',
'type': 'Urban Commune'
}, {
'name': 'Kantuot',
'type': 'Urban Commune'
}, {
'name': 'Kou Loab',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Chraeng',
'type': 'Urban Commune'
}, {
'name': 'Sambok',
'type': 'Urban Commune'
}, {
'name': 'Thma Andaeuk',
'type': 'Urban Commune'
}, {
'name': 'Thma Kreae',
'type': 'Urban Commune'
}, {
'name': 'Thmei',
'type': 'Urban Commune'
}]
}, {
'name': 'Kratie Municipality',
'communes': [{
'name': 'Kaoh Trong',
'type': 'Urban Commune'
}, {
'name': 'Krakor',
'type': 'Urban Commune'
}, {
'name': 'Kracheh',
'type': 'Urban Commune'
}, {
'name': 'Ou Ruessei',
'type': 'Urban Commune'
}, {
'name': 'Roka Kandal',
'type': 'Urban Commune'
}]
}, {
'name': 'Preaek Prasob',
'communes': [{
'name': 'Chambak',
'type': 'Urban Commune'
}, {
'name': 'Chrouy Banteay',
'type': 'Urban Commune'
}, {
'name': 'Kampong Kor',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Ta Suy',
'type': 'Urban Commune'
}, {
'name': 'Preaek Prasab',
'type': 'Urban Commune'
}, {
'name': 'Ruessei Keo',
'type': 'Urban Commune'
}, {
'name': 'Saob',
'type': 'Urban Commune'
}, {
'name': 'Ta Mau',
'type': 'Urban Commune'
}]
}, {
'name': 'Sombour',
'communes': [{
'name': 'Beung Char',
'type': 'Urban Commune'
}, {
'name': 'Kampong Cham',
'type': 'Urban Commune'
}, {
'name': 'Kbal Domrei',
'type': 'Urban Commune'
}, {
'name': 'Koh Knhae',
'type': 'Urban Commune'
}, {
'name': 'Ou Kreang',
'type': 'Urban Commune'
}, {
'name': 'Rolous Meanchey',
'type': 'Urban Commune'
}, {
'name': 'Sombo',
'type': 'Urban Commune'
}, {
'name': 'Sandann',
'type': 'Urban Commune'
}, {
'name': 'Srae Chis',
'type': 'Urban Commune'
}, {
'name': 'Vadhnak',
'type': 'Urban Commune'
}]
}, {
'name': 'Snoul District',
'communes': [{
'name': 'Khsuem',
'type': 'Urban Commune'
}, {
'name': 'Pir Thnu',
'type': 'Urban Commune'
}, {
'name': 'Snuol',
'type': 'Urban Commune'
}, {
'name': 'Srae Char',
'type': 'Urban Commune'
}, {
'name': 'Svay Chreah',
'type': 'Urban Commune'
}, {
'name': 'Kronhoung Saen Chey',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Mondulkiri Province',
'districtInfos': [{
'name': 'Kaev Seima ',
'communes': [{
'name': 'Chong Phlas',
'type': 'Urban Commune'
}, {
'name': 'Memorng',
'type': 'Urban Commune'
}, {
'name': 'Sre Chhouk',
'type': 'Urban Commune'
}, {
'name': 'Sre Khtum',
'type': 'Urban Commune'
}]
}, {
'name': 'Kaoh Nheaek',
'communes': [{
'name': 'Nang Khi Loek',
'type': 'Urban Commune'
}, {
'name': 'Or Boun Leu',
'type': 'Urban Commune'
}, {
'name': 'Ro Yor',
'type': 'Urban Commune'
}, {
'name': 'Sokh Sant',
'type': 'Urban Commune'
}, {
'name': 'Sre Huy',
'type': 'Urban Commune'
}, {
'name': 'Sre Songkum',
'type': 'Urban Commune'
}]
}, {
'name': 'Ou Reang',
'communes': [{
'name': 'Dak Dam',
'type': 'Urban Commune'
}, {
'name': 'Saen Monorom',
'type': 'Urban Commune'
}]
}, {
'name': 'Pech Chreada',
'communes': [{
'name': 'Krang Teh',
'type': 'Urban Commune'
}, {
'name': 'Pou Chrey',
'type': 'Urban Commune'
}, {
'name': 'Sre Ompoum',
'type': 'Urban Commune'
}, {
'name': 'Bou Sra',
'type': 'Urban Commune'
}]
}, {
'name': 'Saen Monorom Municipality',
'communes': [{
'name': 'Monorom',
'type': 'Urban Commune'
}, {
'name': 'Rum Monea',
'type': 'Urban Commune'
}, {
'name': 'Sokh Dom',
'type': 'Urban Commune'
}, {
'name': 'Spean Meanchey',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Preah Vihear Province',
'districtInfos': [{
'name': 'Tbaeng Meanchey',
'communes': [{
'name': 'Chhean Mukh',
'type': 'Urban Commune'
}, {
'name': 'Pou',
'type': 'Urban Commune'
}, {
'name': 'Prame',
'type': 'Urban Commune'
}, {
'name': 'Preah Khleang',
'type': 'Urban Commune'
}]
}, {
'name': 'Chey Saen',
'communes': [{
'name': 'S\'ang',
'type': 'Urban Commune'
}, {
'name': 'Tasu',
'type': 'Urban Commune'
}, {
'name': 'Khyang',
'type': 'Urban Commune'
}, {
'name': 'Chrach',
'type': 'Urban Commune'
}, {
'name': 'Thmea',
'type': 'Urban Commune'
}, {
'name': 'Putrea',
'type': 'Urban Commune'
}]
}, {
'name': 'Chhaeb',
'communes': [{
'name': 'Chhaeb Muoy',
'type': 'Urban Commune'
}, {
'name': 'Chhaeb Pir',
'type': 'Urban Commune'
}, {
'name': 'Sangkae Muoy',
'type': 'Urban Commune'
}, {
'name': 'Sangkae Pir',
'type': 'Urban Commune'
}, {
'name': 'Mlu Prey Muoy',
'type': 'Urban Commune'
}, {
'name': 'Mlu Prey Pir',
'type': 'Urban Commune'
}, {
'name': 'Kampong Sralau Muoy',
'type': 'Urban Commune'
}, {
'name': 'Kampong Sralau Pir',
'type': 'Urban Commune'
}]
}, {
'name': 'Choam Khsant',
'communes': [{
'name': 'Choam Ksant',
'type': 'Urban Commune'
}, {
'name': 'Tuek Kraham',
'type': 'Urban Commune'
}, {
'name': 'Pring Thum',
'type': 'Urban Commune'
}, {
'name': 'Rumdaoh Srae',
'type': 'Urban Commune'
}, {
'name': 'Yeang',
'type': 'Urban Commune'
}, {
'name': 'Kantuot',
'type': 'Urban Commune'
}, {
'name': 'Sror Aem',
'type': 'Urban Commune'
}, {
'name': 'Morokot',
'type': 'Urban Commune'
}]
}, {
'name': 'Kulen',
'communes': [{
'name': 'Kuleaen Tboung',
'type': 'Urban Commune'
}, {
'name': 'Kuleaen Cheung',
'type': 'Urban Commune'
}, {
'name': 'Thmei',
'type': 'Urban Commune'
}, {
'name': 'Phnum Penh',
'type': 'Urban Commune'
}, {
'name': 'Phnum Tbaeng Pir',
'type': 'Urban Commune'
}, {
'name': 'Srayang',
'type': 'Urban Commune'
}]
}, {
'name': 'Rovieng',
'communes': [{
'name': 'Robieb',
'type': 'Urban Commune'
}, {
'name': 'Reaksmei',
'type': 'Urban Commune'
}, {
'name': 'Rohas',
'type': 'Urban Commune'
}, {
'name': 'Rung Roeang',
'type': 'Urban Commune'
}, {
'name': 'Rik Reay',
'type': 'Urban Commune'
}, {
'name': 'Ruos Roan',
'type': 'Urban Commune'
}, {
'name': 'Rotanak',
'type': 'Urban Commune'
}, {
'name': 'Rieb Roy',
'type': 'Urban Commune'
}, {
'name': 'Reaksa',
'type': 'Urban Commune'
}, {
'name': 'Rumdaoh',
'type': 'Urban Commune'
}, {
'name': 'Romtum',
'type': 'Urban Commune'
}, {
'name': 'Romoneiy',
'type': 'Urban Commune'
}]
}, {
'name': 'Preah Vihear Municipality',
'communes': [{
'name': 'Kampong Bronak',
'type': 'Urban Commune'
}, {
'name': 'Pal Hal',
'type': 'Urban Commune'
}]
}, {
'name': 'Sangkum Thmei',
'communes': [{
'name': 'Chamraeun',
'type': 'Urban Commune'
}, {
'name': 'Ro\'ang',
'type': 'Urban Commune'
}, {
'name': 'Phnum Tbaeng Muoy',
'type': 'Urban Commune'
}, {
'name': 'Sdau',
'type': 'Urban Commune'
}, {
'name': 'Ronak Ser',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Prey Veng Province',
'districtInfos': [{
'name': 'Prey Veng Municipality',
'communes': [{
'name': 'Baray',
'type': 'Urban Commune'
}, {
'name': 'Cheung Teuk',
'type': 'Urban Commune'
}, {
'name': 'Kampong Leav',
'type': 'Urban Commune'
}, {
'name': 'Ta Kao',
'type': 'Urban Commune'
}]
}, {
'name': 'Preah Sdach',
'communes': [{
'name': 'Angkor Reach',
'type': 'Urban Commune'
}, {
'name': 'Banteay Chakrei',
'type': 'Urban Commune'
}, {
'name': 'Beung Doal',
'type': 'Urban Commune'
}, {
'name': 'Chey Kompork',
'type': 'Urban Commune'
}, {
'name': 'Kampong Singh',
'type': 'Urban Commune'
}, {
'name': 'Krang Svay',
'type': 'Urban Commune'
}, {
'name': 'Lvea',
'type': 'Urban Commune'
}, {
'name': 'Preah Sdach',
'type': 'Urban Commune'
}, {
'name': 'Reathor',
'type': 'Urban Commune'
}, {
'name': 'Romchek',
'type': 'Urban Commune'
}, {
'name': 'Sena Reach Udom',
'type': 'Urban Commune'
}]
}, {
'name': 'Ba Phnum',
'communes': [{
'name': 'Beung Preah',
'type': 'Urban Commune'
}, {
'name': 'Cheung Phnum',
'type': 'Urban Commune'
}, {
'name': 'Chheu Kach',
'type': 'Urban Commune'
}, {
'name': 'Reaks Chey',
'type': 'Urban Commune'
}, {
'name': 'Roang Domrei',
'type': 'Urban Commune'
}, {
'name': 'Sdeu Koang',
'type': 'Urban Commune'
}, {
'name': 'Speu Ka',
'type': 'Urban Commune'
}, {
'name': 'Speu Kha',
'type': 'Urban Commune'
}, {
'name': 'Theay',
'type': 'Urban Commune'
}]
}, {
'name': 'Kamchay Mear',
'communes': [{
'name': 'Cheach',
'type': 'Urban Commune'
}, {
'name': 'Daun Keung',
'type': 'Urban Commune'
}, {
'name': 'Kra Nhoung',
'type': 'Urban Commune'
}, {
'name': 'Krabao',
'type': 'Urban Commune'
}, {
'name': 'Seang Khveang',
'type': 'Urban Commune'
}, {
'name': 'Smoang Khang Cheung',
'type': 'Urban Commune'
}, {
'name': 'Smoang Khang Tbong',
'type': 'Urban Commune'
}, {
'name': 'Trabeak',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampong Trabeak',
'communes': [{
'name': 'Ansoang',
'type': 'Urban Commune'
}, {
'name': 'Cham',
'type': 'Urban Commune'
}, {
'name': 'Cheang Daek',
'type': 'Urban Commune'
}, {
'name': 'Chrey',
'type': 'Urban Commune'
}, {
'name': 'Kamsoam Ork',
'type': 'Urban Commune'
}, {
'name': 'Kampong Trabaek',
'type': 'Urban Commune'
}, {
'name': 'Peam Montear',
'type': 'Urban Commune'
}, {
'name': 'Oeam Montear',
'type': 'Urban Commune'
}, {
'name': 'Brasat',
'type': 'Urban Commune'
}, {
'name': 'Brotheat',
'type': 'Urban Commune'
}, {
'name': 'Prey Chhor',
'type': 'Urban Commune'
}, {
'name': 'Prey Poan',
'type': 'Urban Commune'
}, {
'name': 'Thkov',
'type': 'Urban Commune'
}]
}, {
'name': 'Kanhchriech',
'communes': [{
'name': 'Chong Ampil',
'type': 'Urban Commune'
}, {
'name': 'Kanhchriech',
'type': 'Urban Commune'
}, {
'name': 'Kdeung Reay',
'type': 'Urban Commune'
}, {
'name': 'Koak Kung Kert',
'type': 'Urban Commune'
}, {
'name': 'Koak Kung Lech',
'type': 'Urban Commune'
}, {
'name': 'Preal',
'type': 'Urban Commune'
}, {
'name': 'Thmar Poun',
'type': 'Urban Commune'
}, {
'name': 'Tnoat',
'type': 'Urban Commune'
}]
}, {
'name': 'Me Sang',
'communes': [{
'name': 'Angkor Sor',
'type': 'Urban Commune'
}, {
'name': 'Chres',
'type': 'Urban Commune'
}, {
'name': 'Chi Phuch',
'type': 'Urban Commune'
}, {
'name': 'Prey Khnes',
'type': 'Urban Commune'
}, {
'name': 'Prey Romdeng',
'type': 'Urban Commune'
}, {
'name': 'Prey Toteung',
'type': 'Urban Commune'
}, {
'name': 'Svay Chrum',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Srae',
'type': 'Urban Commune'
}]
}, {
'name': 'Peam Chor',
'communes': [{
'name': 'Angkor Angk',
'type': 'Urban Commune'
}, {
'name': 'Kampong Brasat',
'type': 'Urban Commune'
}, {
'name': 'Koh Chek',
'type': 'Urban Commune'
}, {
'name': 'Koh Roka',
'type': 'Urban Commune'
}, {
'name': 'Koh Sompov',
'type': 'Urban Commune'
}, {
'name': 'Krang Tayorng',
'type': 'Urban Commune'
}, {
'name': 'Praek Krabau',
'type': 'Urban Commune'
}, {
'name': 'Russei Srok',
'type': 'Urban Commune'
}, {
'name': 'Praek Sombour',
'type': 'Urban Commune'
}, {
'name': 'Svay Phlous',
'type': 'Urban Commune'
}]
}, {
'name': 'Peam Ro',
'communes': [{
'name': 'Baboang',
'type': 'Urban Commune'
}, {
'name': 'Banlich Brasat',
'type': 'Urban Commune'
}, {
'name': 'Neak Leung',
'type': 'Urban Commune'
}, {
'name': 'Peam Meanchey',
'type': 'Urban Commune'
}, {
'name': 'Pream Ro',
'type': 'Urban Commune'
}, {
'name': 'Praek Ksay ka',
'type': 'Urban Commune'
}, {
'name': 'Praek Ksay kha',
'type': 'Urban Commune'
}, {
'name': 'Prey Kandieng',
'type': 'Urban Commune'
}]
}, {
'name': 'Pea Reang',
'communes': [{
'name': 'Kampong Popel',
'type': 'Urban Commune'
}, {
'name': 'Kanhchom',
'type': 'Urban Commune'
}, {
'name': 'Kampong Braing',
'type': 'Urban Commune'
}, {
'name': 'Mesar Brochan',
'type': 'Urban Commune'
}, {
'name': 'Prey Phnov',
'type': 'Urban Commune'
}, {
'name': 'Prey Sneat',
'type': 'Urban Commune'
}, {
'name': 'Prey Srolet',
'type': 'Urban Commune'
}, {
'name': 'Reab ',
'type': 'Urban Commune'
}, {
'name': 'Roka',
'type': 'Urban Commune'
}]
}, {
'name': 'Por Reang',
'communes': [{
'name': 'Pou Rieng',
'type': 'Urban Commune'
}, {
'name': 'Preaek Anteah',
'type': 'Urban Commune'
}, {
'name': 'Preaek Chrey',
'type': 'Urban Commune'
}, {
'name': 'Prey Kanlaong',
'type': 'Urban Commune'
}, {
'name': 'Kampong Ruessei',
'type': 'Urban Commune'
}, {
'name': 'Preaek Ta Sar',
'type': 'Urban Commune'
}]
}, {
'name': 'Sithor Kandal',
'communes': [{
'name': 'Ampil Krau',
'type': 'Urban Commune'
}, {
'name': 'Chrey Khmum',
'type': 'Urban Commune'
}, {
'name': 'Lve',
'type': 'Urban Commune'
}, {
'name': 'Phnov Ti Mouy',
'type': 'Urban Commune'
}, {
'name': 'Phnov Ti Pur',
'type': 'Urban Commune'
}, {
'name': 'Pou Ti',
'type': 'Urban Commune'
}, {
'name': 'Praek Changkran',
'type': 'Urban Commune'
}, {
'name': 'Prey Deum Thneung',
'type': 'Urban Commune'
}, {
'name': 'Prey Teung',
'type': 'Urban Commune'
}, {
'name': 'Romlech',
'type': 'Urban Commune'
}, {
'name': 'Russei Sanh',
'type': 'Urban Commune'
}]
}, {
'name': 'Svay Ontor',
'communes': [{
'name': 'Angkor Tret',
'type': 'Urban Commune'
}, {
'name': 'Chea Khlang',
'type': 'Urban Commune'
}, {
'name': 'Chrey',
'type': 'Urban Commune'
}, {
'name': 'Damrey Puon',
'type': 'Urban Commune'
}, {
'name': 'Mebon',
'type': 'Urban Commune'
}, {
'name': 'Pean Rong',
'type': 'Urban Commune'
}, {
'name': 'Po Puos',
'type': 'Urban Commune'
}, {
'name': 'Prey Khla',
'type': 'Urban Commune'
}, {
'name': 'Samrong',
'type': 'Urban Commune'
}, {
'name': 'Svay Antor',
'type': 'Urban Commune'
}, {
'name': 'Teuk Thla',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Pursat Province',
'districtInfos': [{
'name': 'Bakan',
'communes': [{
'name': 'Boeng Bat Kandal',
'type': 'Urban Commune'
}, {
'name': 'Boeng Khnar',
'type': 'Urban Commune'
}, {
'name': 'Khnar Totueng',
'type': 'Urban Commune'
}, {
'name': 'Me Tuek',
'type': 'Urban Commune'
}, {
'name': 'Ou Ta Paong',
'type': 'Urban Commune'
}, {
'name': 'Rumlech',
'type': 'Urban Commune'
}, {
'name': 'Snam Preah',
'type': 'Urban Commune'
}, {
'name': 'Svay Doun Kaev',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Chorng',
'type': 'Urban Commune'
}]
}, {
'name': 'Kandieng',
'communes': [{
'name': 'Anlong Vil',
'type': 'Urban Commune'
}, {
'name': 'Kandieng',
'type': 'Urban Commune'
}, {
'name': 'Kanhchor',
'type': 'Urban Commune'
}, {
'name': 'Reang Til',
'type': 'Urban Commune'
}, {
'name': 'Srae Sdok',
'type': 'Urban Commune'
}, {
'name': 'Svay Luong',
'type': 'Urban Commune'
}, {
'name': 'Sya',
'type': 'Urban Commune'
}, {
'name': 'Veal',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Chum',
'type': 'Urban Commune'
}]
}, {
'name': 'Krakor',
'communes': [{
'name': 'Anlong Tnaot',
'type': 'Urban Commune'
}, {
'name': 'Ansa Chambak',
'type': 'Urban Commune'
}, {
'name': 'Boeng Kantuot',
'type': 'Urban Commune'
}, {
'name': 'Chheu Tom',
'type': 'Urban Commune'
}, {
'name': 'Kampong Luong',
'type': 'Urban Commune'
}, {
'name': 'Kampong Pou',
'type': 'Urban Commune'
}, {
'name': 'Kbal Trach',
'type': 'Urban Commune'
}, {
'name': 'Ou Sandan',
'type': 'Urban Commune'
}, {
'name': 'Sna Ansa',
'type': 'Urban Commune'
}, {
'name': 'Svay Sa',
'type': 'Urban Commune'
}, {
'name': 'Tnaot Chum',
'type': 'Urban Commune'
}]
}, {
'name': 'Phnum Kravanh',
'communes': [{
'name': 'Bak Choncheanh',
'type': 'Urban Commune'
}, {
'name': 'Leach',
'type': 'Urban Commune'
}, {
'name': 'Pteah Rong',
'type': 'Urban Commune'
}, {
'name': 'Prognel',
'type': 'Urban Commune'
}, {
'name': 'Rokat',
'type': 'Urban Commune'
}, {
'name': 'Sontrer',
'type': 'Urban Commune'
}, {
'name': 'Somrong',
'type': 'Urban Commune'
}]
}, {
'name': 'Pursat Municipality',
'communes': [{
'name': 'Chamraeun Phal',
'type': 'Urban Commune'
}, {
'name': 'Lolok Sa',
'type': 'Urban Commune'
}, {
'name': 'Phteah Prey',
'type': 'Urban Commune'
}, {
'name': 'Prey Nhi',
'type': 'Urban Commune'
}, {
'name': 'Roleab',
'type': 'Urban Commune'
}, {
'name': 'Svay At',
'type': 'Urban Commune'
}, {
'name': 'Banteay Dei',
'type': 'Urban Commune'
}]
}, {
'name': 'Veal Veaeng',
'communes': [{
'name': 'Or Sorm',
'type': 'Urban Commune'
}, {
'name': 'Kropeu 2',
'type': 'Urban Commune'
}, {
'name': 'Anlong Reab',
'type': 'Urban Commune'
}, {
'name': 'Bromoay',
'type': 'Urban Commune'
}, {
'name': 'Thma Da',
'type': 'Urban Commune'
}]
}, {
'name': 'Talou Sen Chey',
'communes': [{
'name': 'Ta Lou',
'type': 'Urban Commune'
}, {
'name': 'Phteah Rung',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Ratanakiri Province',
'districtInfos': [{
'name': 'Andoung Meas',
'communes': [{
'name': 'Malik',
'type': 'Urban Commune'
}, {
'name': 'Mai Hie',
'type': 'Urban Commune'
}, {
'name': 'Nhang',
'type': 'Urban Commune'
}, {
'name': 'Ta Lav',
'type': 'Urban Commune'
}]
}, {
'name': 'Krong Banlung',
'communes': [{
'name': 'Kanchanh',
'type': 'Urban Commune'
}, {
'name': 'Labansiek',
'type': 'Urban Commune'
}, {
'name': 'Yeak Laom',
'type': 'Urban Commune'
}, {
'name': 'Boeng Kansaeng',
'type': 'Urban Commune'
}]
}, {
'name': 'Bar Kaev',
'communes': [{
'name': 'Kak',
'type': 'Urban Commune'
}, {
'name': 'Ke Chong ',
'type': 'Urban Commune'
}, {
'name': 'Laming (Laminh)',
'type': 'Urban Commune'
}, {
'name': 'Lung Khung',
'type': 'Urban Commune'
}, {
'name': 'Seung (Saeung) ',
'type': 'Urban Commune'
}, {
'name': 'Ting Chak ',
'type': 'Urban Commune'
}]
}, {
'name': 'Koun Mom',
'communes': [{
'name': 'Serei Mongkol',
'type': 'Urban Commune'
}, {
'name': 'Srae Angkrong',
'type': 'Urban Commune'
}, {
'name': 'Ta Ang',
'type': 'Urban Commune'
}, {
'name': 'Toen',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Chres',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Kraham',
'type': 'Urban Commune'
}]
}, {
'name': 'Lumphat',
'communes': [{
'name': 'Chey Otdam',
'type': 'Urban Commune'
}, {
'name': 'Ka Laeng',
'type': 'Urban Commune'
}, {
'name': 'La Bang Muoy',
'type': 'Urban Commune'
}, {
'name': 'La Bang Pir',
'type': 'Urban Commune'
}, {
'name': 'Pa Tang (Ba Tang)',
'type': 'Urban Commune'
}, {
'name': 'Seda',
'type': 'Urban Commune'
}]
}, {
'name': 'Ou Chum',
'communes': [{
'name': 'Cha Ung',
'type': 'Urban Commune'
}, {
'name': 'Chan/Pouy',
'type': 'Urban Commune'
}, {
'name': 'Aekakpheap',
'type': 'Urban Commune'
}, {
'name': 'Kalai',
'type': 'Urban Commune'
}, {
'name': 'Ou Chum',
'type': 'Urban Commune'
}, {
'name': 'Sameakki',
'type': 'Urban Commune'
}, {
'name': 'L\'ak',
'type': 'Urban Commune'
}]
}, {
'name': 'Ou Ya Dav',
'communes': [{
'name': 'Bar Kham',
'type': 'Urban Commune'
}, {
'name': 'Lum Choar',
'type': 'Urban Commune'
}, {
'name': 'Pak Nhai',
'type': 'Urban Commune'
}, {
'name': 'Pate',
'type': 'Urban Commune'
}, {
'name': 'Sesant',
'type': 'Urban Commune'
}, {
'name': 'Saom Thum',
'type': 'Urban Commune'
}, {
'name': 'Ya Tung',
'type': 'Urban Commune'
}]
}, {
'name': 'Ta Veaeng',
'communes': [{
'name': 'Ta Veaeng Leu',
'type': 'Urban Commune'
}, {
'name': 'Ta Veaeng Kraom',
'type': 'Urban Commune'
}]
}, {
'name': 'Veun Sai',
'communes': [{
'name': 'Ban Pong',
'type': 'Urban Commune'
}, {
'name': 'Hat Pak',
'type': 'Urban Commune'
}, {
'name': 'Ka Choun',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Pang',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Peak',
'type': 'Urban Commune'
}, {
'name': 'Kok Lak',
'type': 'Urban Commune'
}, {
'name': 'Pa Kalan',
'type': 'Urban Commune'
}, {
'name': 'Phnum Kok',
'type': 'Urban Commune'
}, {
'name': 'Veun Sai',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Siem Reap Province',
'districtInfos': [{
'name': 'Angkor chum',
'communes': [{
'name': 'Char Chhuk',
'type': 'Urban Commune'
}, {
'name': 'Doun Peaeng ',
'type': 'Urban Commune'
}, {
'name': 'Kouk Doung ',
'type': 'Urban Commune'
}, {
'name': 'Koul ',
'type': 'Urban Commune'
}, {
'name': 'Nokor Pheas ',
'type': 'Urban Commune'
}, {
'name': 'Srae Khvav ',
'type': 'Urban Commune'
}, {
'name': 'Ta Saom',
'type': 'Urban Commune'
}]
}, {
'name': 'Angkor Thom',
'communes': [{
'name': 'Chob Ta Trav',
'type': 'Urban Commune'
}, {
'name': 'Leang Dai',
'type': 'Urban Commune'
}, {
'name': 'Peak Snaeng',
'type': 'Urban Commune'
}, {
'name': 'Svay Chek',
'type': 'Urban Commune'
}]
}, {
'name': 'Banteay Srei',
'communes': [{
'name': 'Khnar Sanday',
'type': 'Urban Commune'
}, {
'name': 'Khun Ream',
'type': 'Urban Commune'
}, {
'name': 'Preak Dak',
'type': 'Urban Commune'
}, {
'name': 'Romchek ',
'type': 'Urban Commune'
}, {
'name': 'Run Ta Aek',
'type': 'Urban Commune'
}, {
'name': 'Tbaeng',
'type': 'Urban Commune'
}]
}, {
'name': 'Chi Kraeng',
'communes': [{
'name': 'Anlong Samnor',
'type': 'Urban Commune'
}, {
'name': 'Chi Kraeng',
'type': 'Urban Commune'
}, {
'name': 'Kampong kdei',
'type': 'Urban Commune'
}, {
'name': 'Khvav',
'type': 'Urban Commune'
}, {
'name': 'Koak Thlok Krom',
'type': 'Urban Commune'
}, {
'name': 'Koak Thlok Leu',
'type': 'Urban Commune'
}, {
'name': 'Lveng Russei ',
'type': 'Urban Commune'
}, {
'name': 'Pongro Krom ',
'type': 'Urban Commune'
}, {
'name': 'Pongro Leu',
'type': 'Urban Commune'
}, {
'name': 'Russei Lok',
'type': 'Urban Commune'
}, {
'name': 'Songveuy',
'type': 'Urban Commune'
}, {
'name': 'Spean Tnoat',
'type': 'Urban Commune'
}]
}, {
'name': 'Kralanh',
'communes': [{
'name': 'Chonloas Dai',
'type': 'Urban Commune'
}, {
'name': 'Kampong Thkov',
'type': 'Urban Commune'
}, {
'name': 'Kralanh',
'type': 'Urban Commune'
}, {
'name': 'Krouch Kor',
'type': 'Urban Commune'
}, {
'name': 'Roung Kou',
'type': 'Urban Commune'
}, {
'name': 'Sambuor',
'type': 'Urban Commune'
}, {
'name': 'Saen Sokh',
'type': 'Urban Commune'
}, {
'name': 'Snuol',
'type': 'Urban Commune'
}, {
'name': 'Sranal',
'type': 'Urban Commune'
}, {
'name': 'Ta An',
'type': 'Urban Commune'
}]
}, {
'name': 'Puok ',
'communes': [{
'name': 'Sasar Sdam',
'type': 'Urban Commune'
}, {
'name': 'Doun Keo',
'type': 'Urban Commune'
}, {
'name': 'Kdei Run',
'type': 'Urban Commune'
}, {
'name': 'Keo Poar',
'type': 'Urban Commune'
}, {
'name': 'Khnat',
'type': 'Urban Commune'
}, {
'name': 'Lvea',
'type': 'Urban Commune'
}, {
'name': 'Mukh Paen',
'type': 'Urban Commune'
}, {
'name': 'Pou Treay',
'type': 'Urban Commune'
}, {
'name': 'Puok',
'type': 'Urban Commune'
}, {
'name': 'Prey Chruk',
'type': 'Urban Commune'
}, {
'name': 'Reul',
'type': 'Urban Commune'
}, {
'name': 'Samraong Yea',
'type': 'Urban Commune'
}, {
'name': 'Trei Nhoar',
'type': 'Urban Commune'
}, {
'name': 'Yeang',
'type': 'Urban Commune'
}]
}, {
'name': 'Prasat Bakong',
'communes': [{
'name': 'Ampil',
'type': 'Urban Commune'
}, {
'name': 'Bakong ',
'type': 'Urban Commune'
}, {
'name': 'Ballangk ',
'type': 'Urban Commune'
}, {
'name': 'Kampong Phluk ',
'type': 'Urban Commune'
}, {
'name': 'Kantreang',
'type': 'Urban Commune'
}, {
'name': 'Kandaek',
'type': 'Urban Commune'
}, {
'name': 'Mean Chey ',
'type': 'Urban Commune'
}, {
'name': 'Roluos ',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Thom',
'type': 'Urban Commune'
}]
}, {
'name': 'Siem Reap',
'communes': [{
'name': 'Sla Kram',
'type': 'Urban Commune'
}, {
'name': 'Svay Dankum',
'type': 'Urban Commune'
}, {
'name': 'Kouk Chak',
'type': 'Urban Commune'
}, {
'name': 'Sala Kamreuk',
'type': 'Urban Commune'
}, {
'name': 'Nokor Thum',
'type': 'Urban Commune'
}, {
'name': 'Chreav',
'type': 'Urban Commune'
}, {
'name': 'Chong Knies',
'type': 'Urban Commune'
}, {
'name': 'Sambuor',
'type': 'Urban Commune'
}, {
'name': 'Siem Reab',
'type': 'Urban Commune'
}, {
'name': 'Srangae',
'type': 'Urban Commune'
}, {
'name': 'Krabei Riel',
'type': 'Urban Commune'
}, {
'name': 'Tuek Vil',
'type': 'Urban Commune'
}]
}, {
'name': 'Soutr Nikom',
'communes': [{
'name': 'Chan Sar',
'type': 'Urban Commune'
}, {
'name': 'Dam Daek',
'type': 'Urban Commune'
}, {
'name': 'Dan Run',
'type': 'Urban Commune'
}, {
'name': 'Kampong Khleang',
'type': 'Urban Commune'
}, {
'name': 'Kien Sangkae',
'type': 'Urban Commune'
}, {
'name': 'Khchas',
'type': 'Urban Commune'
}, {
'name': 'Khnar Pou',
'type': 'Urban Commune'
}, {
'name': 'Popel',
'type': 'Urban Commune'
}, {
'name': 'Samraong',
'type': 'Urban Commune'
}, {
'name': 'Ta Yaek',
'type': 'Urban Commune'
}]
}, {
'name': 'Srei Snam',
'communes': [{
'name': 'Chrouy Neang Nguon Commune',
'type': 'Urban Commune'
}, {
'name': 'Klang Hay Commune',
'type': 'Urban Commune'
}, {
'name': 'Tram Sasar',
'type': 'Urban Commune'
}, {
'name': 'Moung Commune',
'type': 'Urban Commune'
}, {
'name': 'Prei Commune',
'type': 'Urban Commune'
}, {
'name': 'Slaeng Spean Commune',
'type': 'Urban Commune'
}]
}, {
'name': 'Svay Leu',
'communes': [{
'name': 'Boeng Mealea',
'type': 'Urban Commune'
}, {
'name': 'Kantuot',
'type': 'Urban Commune'
}, {
'name': 'Khnang Phnum',
'type': 'Urban Commune'
}, {
'name': 'Svay Leu',
'type': 'Urban Commune'
}, {
'name': 'Ta Siem',
'type': 'Urban Commune'
}]
}, {
'name': 'Varin',
'communes': [{
'name': 'Prasat',
'type': 'Urban Commune'
}, {
'name': 'Lvea Krang ',
'type': 'Urban Commune'
}, {
'name': 'Srae Nouy ',
'type': 'Urban Commune'
}, {
'name': 'Svay Sa ',
'type': 'Urban Commune'
}, {
'name': 'Varin',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Preah Sihanouk Province',
'districtInfos': [{
'name': 'Krong Preah Sihanouk',
'communes': [{
'name': 'Sangkat Muoy',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Pir',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Bei',
'type': 'Urban Commune'
}, {
'name': 'Sangkat Buon',
'type': 'Urban Commune'
}, {
'name': 'Koh Rong',
'type': 'Urban Commune'
}]
}, {
'name': 'Steung Hav',
'communes': [{
'name': 'Kompenh',
'type': 'Urban Commune'
}, {
'name': 'Ou Treh',
'type': 'Urban Commune'
}, {
'name': 'Tomnob Rolork',
'type': 'Urban Commune'
}, {
'name': 'Keo Phos',
'type': 'Urban Commune'
}]
}, {
'name': 'Prey Nob',
'communes': [{
'name': 'Andong Thmar',
'type': 'Urban Commune'
}, {
'name': 'Beung TaPrum',
'type': 'Urban Commune'
}, {
'name': 'Bet Trang',
'type': 'Urban Commune'
}, {
'name': 'Cheung Koar',
'type': 'Urban Commune'
}, {
'name': 'Ou Chrov',
'type': 'Urban Commune'
}, {
'name': 'Ou Oknha Heng',
'type': 'Urban Commune'
}, {
'name': 'Prey Nob',
'type': 'Urban Commune'
}, {
'name': 'Ream',
'type': 'Urban Commune'
}, {
'name': 'Sammaki',
'type': 'Urban Commune'
}, {
'name': 'Somrong ',
'type': 'Urban Commune'
}, {
'name': 'Teuk Laak',
'type': 'Urban Commune'
}, {
'name': 'Teuk Tla',
'type': 'Urban Commune'
}, {
'name': 'Toul Toteung',
'type': 'Urban Commune'
}, {
'name': 'Veal Rinh',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampong Seila',
'communes': [{
'name': 'Chomkar Loung',
'type': 'Urban Commune'
}, {
'name': 'Kampong Seila',
'type': 'Urban Commune'
}, {
'name': 'Ou Bak Roteh',
'type': 'Urban Commune'
}, {
'name': 'Steung Chhay',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Stung Treng Province ',
'districtInfos': [{
'name': 'Sesan',
'communes': [{
'name': '\tKomphun',
'type': 'Urban Commune'
}, {
'name': 'Kbal Romeas',
'type': 'Urban Commune'
}, {
'name': '\tPhluk',
'type': 'Urban Commune'
}, {
'name': '\tSam Khouy',
'type': 'Urban Commune'
}, {
'name': '\tSdau',
'type': 'Urban Commune'
}, {
'name': '\tSrae Kor',
'type': 'Urban Commune'
}, {
'name': '\tTa Lat',
'type': 'Urban Commune'
}]
}, {
'name': 'Siem Bouk',
'communes': [{
'name': 'Koh Preah',
'type': 'Urban Commune'
}, {
'name': '\tKoh Sompeay',
'type': 'Urban Commune'
}, {
'name': '\tKoh Srolay',
'type': 'Urban Commune'
}, {
'name': '\tOu Mreah',
'type': 'Urban Commune'
}, {
'name': '\tOu Russei Kandal',
'type': 'Urban Commune'
}, {
'name': '\tSiem Bouk',
'type': 'Urban Commune'
}, {
'name': '\tSrae Krasang',
'type': 'Urban Commune'
}]
}, {
'name': 'Siem Pang',
'communes': [{
'name': '\tPraek Meas',
'type': 'Urban Commune'
}, {
'name': '\tSekong',
'type': 'Urban Commune'
}, {
'name': '\tSantepheap',
'type': 'Urban Commune'
}, {
'name': '\tSrae Sombour',
'type': 'Urban Commune'
}, {
'name': '\tThma Keo',
'type': 'Urban Commune'
}]
}, {
'name': 'Thala Barivat',
'communes': [{
'name': '\tAnlong Phe',
'type': 'Urban Commune'
}, {
'name': '\tChomkar Leu',
'type': 'Urban Commune'
}, {
'name': '\tKang Cham',
'type': 'Urban Commune'
}, {
'name': '\tKoh Snaeng',
'type': 'Urban Commune'
}, {
'name': '\tAnlong Chrey',
'type': 'Urban Commune'
}, {
'name': '\tOu Rai',
'type': 'Urban Commune'
}, {
'name': '\tOu Svay',
'type': 'Urban Commune'
}, {
'name': '\tPreah Romkel',
'type': 'Urban Commune'
}, {
'name': '\tSom Ang',
'type': 'Urban Commune'
}, {
'name': 'Srae Russei',
'type': 'Urban Commune'
}, {
'name': 'Thala Borivat',
'type': 'Urban Commune'
}]
}, {
'name': 'Krong Stung Treng',
'communes': [{
'name': 'Stung Treng',
'type': 'Urban Commune'
}, {
'name': 'Srah Russei',
'type': 'Urban Commune'
}, {
'name': 'Preah Bat',
'type': 'Urban Commune'
}, {
'name': 'Samaki',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Svay Rieng Province',
'districtInfos': [{
'name': 'Chantrea',
'communes': [{
'name': 'Chantrea',
'type': 'Urban Commune'
}, {
'name': 'Chres',
'type': 'Urban Commune'
}, {
'name': 'Mesar Thgnork',
'type': 'Urban Commune'
}, {
'name': 'Prey Kokir',
'type': 'Urban Commune'
}, {
'name': 'Somroang',
'type': 'Urban Commune'
}, {
'name': 'Toul Sdei',
'type': 'Urban Commune'
}]
}, {
'name': 'Rumduol',
'communes': [{
'name': 'Bos Mon',
'type': 'Urban Commune'
}, {
'name': 'Thmea',
'type': 'Urban Commune'
}, {
'name': 'Kampong Chork',
'type': 'Urban Commune'
}, {
'name': 'Chrong Popel',
'type': 'Urban Commune'
}, {
'name': 'Kampong Ampel',
'type': 'Urban Commune'
}, {
'name': 'Meun Chey',
'type': 'Urban Commune'
}, {
'name': 'Porng Teuk',
'type': 'Urban Commune'
}, {
'name': 'Sangkae',
'type': 'Urban Commune'
}, {
'name': 'Svay Chek',
'type': 'Urban Commune'
}, {
'name': 'Thna Thnung',
'type': 'Urban Commune'
}]
}, {
'name': 'Svay Chrum',
'communes': [{
'name': 'Angk Taso',
'type': 'Urban Commune'
}, {
'name': 'Bassak',
'type': 'Urban Commune'
}, {
'name': 'Chombok',
'type': 'Urban Commune'
}, {
'name': 'Kampong Chomlong',
'type': 'Urban Commune'
}, {
'name': 'Ta Suos',
'type': 'Urban Commune'
}, {
'name': 'Chheu Teal',
'type': 'Urban Commune'
}, {
'name': 'Daun Sor',
'type': 'Urban Commune'
}, {
'name': 'Kork Pring',
'type': 'Urban Commune'
}, {
'name': 'Krol Kor',
'type': 'Urban Commune'
}, {
'name': 'Krous',
'type': 'Urban Commune'
}, {
'name': 'Pou Reach',
'type': 'Urban Commune'
}, {
'name': 'Svay Angk',
'type': 'Urban Commune'
}, {
'name': 'Svay Chrum',
'type': 'Urban Commune'
}, {
'name': 'Svay Thom',
'type': 'Urban Commune'
}, {
'name': 'Svay Yea',
'type': 'Urban Commune'
}, {
'name': 'Thlork',
'type': 'Urban Commune'
}]
}, {
'name': 'Svay Teab',
'communes': [{
'name': 'Kokir Soam',
'type': 'Urban Commune'
}, {
'name': 'Kandiang Reay',
'type': 'Urban Commune'
}, {
'name': 'Monorom',
'type': 'Urban Commune'
}, {
'name': 'Popaet',
'type': 'Urban Commune'
}, {
'name': 'Prey Ta Ei',
'type': 'Urban Commune'
}, {
'name': 'Brosotr',
'type': 'Urban Commune'
}, {
'name': 'Romeang Tkorl',
'type': 'Urban Commune'
}, {
'name': 'Sambour',
'type': 'Urban Commune'
}, {
'name': 'Svay Rompear',
'type': 'Urban Commune'
}]
}, {
'name': 'Kampong Rou',
'communes': [{
'name': 'Banteay Krang',
'type': 'Urban Commune'
}, {
'name': 'Nhor',
'type': 'Urban Commune'
}, {
'name': 'Ksetr',
'type': 'Urban Commune'
}, {
'name': 'Preah Ponlea',
'type': 'Urban Commune'
}, {
'name': 'Chrey Thom',
'type': 'Urban Commune'
}, {
'name': 'Reach Monti',
'type': 'Urban Commune'
}, {
'name': 'Somlei',
'type': 'Urban Commune'
}, {
'name': 'Somyorng',
'type': 'Urban Commune'
}, {
'name': 'Svay Tayean',
'type': 'Urban Commune'
}, {
'name': 'Thmei',
'type': 'Urban Commune'
}, {
'name': 'Tnaot',
'type': 'Urban Commune'
}]
}, {
'name': 'Romeas Haek',
'communes': [{
'name': 'Ampel',
'type': 'Urban Commune'
}, {
'name': 'Andong Pou',
'type': 'Urban Commune'
}, {
'name': 'Andong Trabaek',
'type': 'Urban Commune'
}, {
'name': 'Angk Brosrae',
'type': 'Urban Commune'
}, {
'name': 'Chnatrei',
'type': 'Urban Commune'
}, {
'name': 'Chrey Thom',
'type': 'Urban Commune'
}, {
'name': 'Daung',
'type': 'Urban Commune'
}, {
'name': 'Kampong Trach',
'type': 'Urban Commune'
}, {
'name': 'Kokir',
'type': 'Urban Commune'
}, {
'name': 'Krasang',
'type': 'Urban Commune'
}, {
'name': 'Mukh Da',
'type': 'Urban Commune'
}, {
'name': 'Mream',
'type': 'Urban Commune'
}, {
'name': 'Sambour',
'type': 'Urban Commune'
}, {
'name': 'Sambatt Meanchey',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Sdao',
'type': 'Urban Commune'
}, {
'name': 'Trors',
'type': 'Urban Commune'
}]
}, {
'name': 'Krong Svay Rieng',
'communes': [{
'name': 'Svay Rieng',
'type': 'Urban Commune'
}, {
'name': 'Prey Chhlak',
'type': 'Urban Commune'
}, {
'name': 'Koy Trobaek',
'type': 'Urban Commune'
}, {
'name': 'Pou Ta Hao',
'type': 'Urban Commune'
}, {
'name': 'Chek',
'type': 'Urban Commune'
}, {
'name': 'Svay Toea',
'type': 'Urban Commune'
}, {
'name': 'Sangkhoar',
'type': 'Urban Commune'
}]
}, {
'name': 'Krong Bavet',
'communes': [{
'name': 'Bati',
'type': 'Urban Commune'
}, {
'name': 'Bavet',
'type': 'Urban Commune'
}, {
'name': 'Chrork Mtesh',
'type': 'Urban Commune'
}, {
'name': 'Prasat',
'type': 'Urban Commune'
}, {
'name': 'Prey Angkunh',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Takeo Province',
'districtInfos': [{
'name': 'Angkor Borei',
'communes': [{
'name': 'Angkor Borei',
'type': 'Urban Commune'
}, {
'name': 'Ba Srae ',
'type': 'Urban Commune'
}, {
'name': 'Kouk Thlok ',
'type': 'Urban Commune'
}, {
'name': 'Ponley ',
'type': 'Urban Commune'
}, {
'name': 'Prek Phtoul (Preaek Phtoul)',
'type': 'Urban Commune'
}, {
'name': 'Prey Phkoam',
'type': 'Urban Commune'
}]
}, {
'name': 'Kiri Vong ',
'communes': [{
'name': 'Angk Prasat',
'type': 'Urban Commune'
}, {
'name': 'Preah Bat Choan Chum',
'type': 'Urban Commune'
}, {
'name': 'Kamnab',
'type': 'Urban Commune'
}, {
'name': 'Kampeaeng',
'type': 'Urban Commune'
}, {
'name': 'Kiri Chong Kaoh',
'type': 'Urban Commune'
}, {
'name': 'Kouk Prech',
'type': 'Urban Commune'
}, {
'name': 'Phnum Den',
'type': 'Urban Commune'
}, {
'name': 'Prey Ampok',
'type': 'Urban Commune'
}, {
'name': 'Prey Rumdeng',
'type': 'Urban Commune'
}, {
'name': 'Ream Andaeuk',
'type': 'Urban Commune'
}, {
'name': 'Saom Commune',
'type': 'Urban Commune'
}, {
'name': 'Ta Our',
'type': 'Urban Commune'
}]
}, {
'name': 'Samraong',
'communes': [{
'name': 'Boeng Tranh Khang Cheung',
'type': 'Urban Commune'
}, {
'name': 'Boeng Tranh Khang Tboung',
'type': 'Urban Commune'
}, {
'name': 'Cheung Kuon',
'type': 'Urban Commune'
}, {
'name': 'Chumreah Pen',
'type': 'Urban Commune'
}, {
'name': 'Khvav',
'type': 'Urban Commune'
}, {
'name': 'Lumchang',
'type': 'Urban Commune'
}, {
'name': 'Rovieng',
'type': 'Urban Commune'
}, {
'name': 'Samraong',
'type': 'Urban Commune'
}, {
'name': 'Soengh',
'type': 'Urban Commune'
}, {
'name': 'Sla',
'type': 'Urban Commune'
}, {
'name': 'Trea',
'type': 'Urban Commune'
}]
}, {
'name': 'Treang District',
'communes': [{
'name': 'Angkanh',
'type': 'Urban Commune'
}, {
'name': 'Angk Khnor',
'type': 'Urban Commune'
}, {
'name': 'Chi Khma',
'type': 'Urban Commune'
}, {
'name': 'Khvav',
'type': 'Urban Commune'
}, {
'name': 'Prambei Mum',
'type': 'Urban Commune'
}, {
'name': 'Angk Kev (Angk Kaev)',
'type': 'Urban Commune'
}, {
'name': 'Prey Sloek',
'type': 'Urban Commune'
}, {
'name': 'Roneam',
'type': 'Urban Commune'
}, {
'name': 'Sambuor',
'type': 'Urban Commune'
}, {
'name': 'Sanlong',
'type': 'Urban Commune'
}, {
'name': 'Smaong',
'type': 'Urban Commune'
}, {
'name': 'Srangae (Sra-Ngae)',
'type': 'Urban Commune'
}, {
'name': 'Thlok',
'type': 'Urban Commune'
}, {
'name': 'Tralach',
'type': 'Urban Commune'
}]
}, {
'name': 'Bati District',
'communes': [{
'name': 'Chambak',
'type': 'Urban Commune'
}, {
'name': 'Champei',
'type': 'Urban Commune'
}, {
'name': 'Doung',
'type': 'Urban Commune'
}, {
'name': 'Kandoeng',
'type': 'Urban Commune'
}, {
'name': 'Komar Reachea',
'type': 'Urban Commune'
}, {
'name': 'Krang Leav',
'type': 'Urban Commune'
}, {
'name': 'Krang Thnong',
'type': 'Urban Commune'
}, {
'name': 'Lumpong',
'type': 'Urban Commune'
}, {
'name': 'Pea Ream',
'type': 'Urban Commune'
}, {
'name': 'Pot Sar',
'type': 'Urban Commune'
}, {
'name': 'Sour Phi',
'type': 'Urban Commune'
}, {
'name': 'Tang Doung',
'type': 'Urban Commune'
}, {
'name': 'Tnaot',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Krasang',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Sab',
'type': 'Urban Commune'
}]
}, {
'name': 'Kaoh Andaet ',
'communes': [{
'name': 'Krapum Chhuk',
'type': 'Urban Commune'
}, {
'name': 'Pech Sar',
'type': 'Urban Commune'
}, {
'name': 'Prey Khla',
'type': 'Urban Commune'
}, {
'name': 'Prey Yuthka',
'type': 'Urban Commune'
}, {
'name': 'Romenh',
'type': 'Urban Commune'
}, {
'name': 'Thlea Prachum',
'type': 'Urban Commune'
}]
}, {
'name': 'Krong Doun Kaev',
'communes': [{
'name': 'Baray',
'type': 'Urban Commune'
}, {
'name': 'Roka Knong',
'type': 'Urban Commune'
}, {
'name': 'Roka Krau',
'type': 'Urban Commune'
}]
}, {
'name': 'Bourei Cholsar',
'communes': [{
'name': 'Bourei Cholsar ',
'type': 'Urban Commune'
}, {
'name': 'Chey Chouk ',
'type': 'Urban Commune'
}, {
'name': 'Doung Khpos ',
'type': 'Urban Commune'
}, {
'name': 'Kampong Krasang ',
'type': 'Urban Commune'
}, {
'name': 'Kouk Pou ',
'type': 'Urban Commune'
}]
}, {
'name': 'Prey Kabbas',
'communes': [{
'name': 'Angkanh',
'type': 'Urban Commune'
}, {
'name': 'Ban Kam',
'type': 'Urban Commune'
}, {
'name': 'Champa',
'type': 'Urban Commune'
}, {
'name': 'Char',
'type': 'Urban Commune'
}, {
'name': 'Kampeaeng',
'type': 'Urban Commune'
}, {
'name': 'Kampong Reab',
'type': 'Urban Commune'
}, {
'name': 'Kdanh',
'type': 'Urban Commune'
}, {
'name': 'Pou Rumchak',
'type': 'Urban Commune'
}, {
'name': 'Prey Kabbas',
'type': 'Urban Commune'
}, {
'name': 'Prey Lvea',
'type': 'Urban Commune'
}, {
'name': 'Prey Phdau',
'type': 'Urban Commune'
}, {
'name': 'Snao',
'type': 'Urban Commune'
}, {
'name': 'Tang Yab',
'type': 'Urban Commune'
}]
}, {
'name': 'Tram Kak',
'communes': [{
'name': 'Angk Ta Saom',
'type': 'Urban Commune'
}, {
'name': 'Cheang Tong',
'type': 'Urban Commune'
}, {
'name': 'Kus',
'type': 'Urban Commune'
}, {
'name': 'Leay Bour',
'type': 'Urban Commune'
}, {
'name': 'Nhaeng Nhang',
'type': 'Urban Commune'
}, {
'name': 'Our Saray',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Kranhung',
'type': 'Urban Commune'
}, {
'name': 'Otdam Soriya',
'type': 'Urban Commune'
}, {
'name': 'Popel',
'type': 'Urban Commune'
}, {
'name': 'Samraong',
'type': 'Urban Commune'
}, {
'name': 'Srae Ronoung',
'type': 'Urban Commune'
}, {
'name': 'Ta Phem',
'type': 'Urban Commune'
}, {
'name': 'Tram Kak',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Thum Khang Cheung',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Thum Khang Tboung',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Oddar Meanchey Province ',
'districtInfos': [{
'name': 'Anlong Veaeng',
'communes': [{
'name': 'Anlong Veaeng',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Tav',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Prei',
'type': 'Urban Commune'
}, {
'name': 'Lumtong',
'type': 'Urban Commune'
}, {
'name': 'Thlat',
'type': 'Urban Commune'
}]
}, {
'name': 'Chong Kal',
'communes': [{
'name': 'Cheung Tien',
'type': 'Urban Commune'
}, {
'name': 'Chong Kal',
'type': 'Urban Commune'
}, {
'name': 'Krasang',
'type': 'Urban Commune'
}, {
'name': 'Pongro',
'type': 'Urban Commune'
}]
}, {
'name': 'Banteay Ampil',
'communes': [{
'name': 'Ampil',
'type': 'Urban Commune'
}, {
'name': 'Beng',
'type': 'Urban Commune'
}, {
'name': 'Kouk Mon',
'type': 'Urban Commune'
}, {
'name': 'Kouk Khpos',
'type': 'Urban Commune'
}]
}, {
'name': 'Krong Samraong',
'communes': [{
'name': 'Bansay Reak',
'type': 'Urban Commune'
}, {
'name': 'Bos Sbov',
'type': 'Urban Commune'
}, {
'name': 'Koun Kriel',
'type': 'Urban Commune'
}, {
'name': 'Samraong',
'type': 'Urban Commune'
}, {
'name': 'Ou Smach',
'type': 'Urban Commune'
}]
}, {
'name': 'Trapeang Prasat',
'communes': [{
'name': 'Bak Anloung',
'type': 'Urban Commune'
}, {
'name': 'Ph\'av',
'type': 'Urban Commune'
}, {
'name': 'Ou Svay',
'type': 'Urban Commune'
}, {
'name': 'Preah Pralay',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Prasat',
'type': 'Urban Commune'
}, {
'name': 'Tumnob Dach',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Kep Province',
'districtInfos': [{
'name': 'Krong Keb',
'communes': [{
'name': 'Keb',
'type': 'Urban Commune'
}, {
'name': 'Prey Thom',
'type': 'Urban Commune'
}]
}, {
'name': 'Damnak Chang\'Eur',
'communes': [{
'name': 'Angkoal',
'type': 'Urban Commune'
}, {
'name': 'Porng Teuk',
'type': 'Urban Commune'
}, {
'name': 'Ou Krasar',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Pailin Province',
'districtInfos': [{
'name': 'Pailin',
'communes': [{
'name': 'Pailin',
'type': 'Urban Commune'
}, {
'name': 'Ou Ta Vau',
'type': 'Urban Commune'
}, {
'name': 'Tuol Lvea',
'type': 'Urban Commune'
}, {
'name': 'Bar Yakha',
'type': 'Urban Commune'
}]
}, {
'name': 'Sala Krao',
'communes': [{
'name': 'Sala Krau',
'type': 'Urban Commune'
}, {
'name': 'Stueng Trang',
'type': 'Urban Commune'
}, {
'name': 'Stueng Kach',
'type': 'Urban Commune'
}, {
'name': 'Ou Andoung',
'type': 'Urban Commune'
}]
}]
}
}, {
'provinceInfo': {
'name': 'Tboung Khmum Province',
'districtInfos': [{
'name': 'Dombae',
'communes': [{
'name': 'Chong Cheach',
'type': 'Urban Commune'
}, {
'name': 'Dombae',
'type': 'Urban Commune'
}, {
'name': 'Kouk Srok',
'type': 'Urban Commune'
}, {
'name': 'Neang Teut',
'type': 'Urban Commune'
}, {
'name': 'Seda',
'type': 'Urban Commune'
}, {
'name': 'Teuk Chrov',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Pring',
'type': 'Urban Commune'
}]
}, {
'name': 'Krouch Chhma',
'communes': [{
'name': 'Chhuk',
'type': 'Urban Commune'
}, {
'name': 'Chumnik',
'type': 'Urban Commune'
}, {
'name': 'Kampong Treas',
'type': 'Urban Commune'
}, {
'name': 'Kaoh Pir',
'type': 'Urban Commune'
}, {
'name': 'Krouch Chhmar',
'type': 'Urban Commune'
}, {
'name': 'Peus Muoy',
'type': 'Urban Commune'
}, {
'name': 'Peus Pir',
'type': 'Urban Commune'
}, {
'name': 'Preaek a Chi',
'type': 'Urban Commune'
}, {
'name': 'Roka Khnor',
'type': 'Urban Commune'
}, {
'name': 'Svay Khleang',
'type': 'Urban Commune'
}, {
'name': 'Trea',
'type': 'Urban Commune'
}, {
'name': 'Tuol Snuol',
'type': 'Urban Commune'
}]
}, {
'name': 'Memot',
'communes': [{
'name': 'Chan Mul',
'type': 'Urban Commune'
}, {
'name': 'Choam',
'type': 'Urban Commune'
}, {
'name': 'Choam Kravien',
'type': 'Urban Commune'
}, {
'name': 'Choam Ta Mau',
'type': 'Urban Commune'
}, {
'name': 'Dar',
'type': 'Urban Commune'
}, {
'name': 'Kampoan',
'type': 'Urban Commune'
}, {
'name': 'Memong',
'type': 'Urban Commune'
}, {
'name': 'Memot',
'type': 'Urban Commune'
}, {
'name': 'Rung',
'type': 'Urban Commune'
}, {
'name': 'Rumchek',
'type': 'Urban Commune'
}, {
'name': 'Tramung',
'type': 'Urban Commune'
}, {
'name': 'Tonlung',
'type': 'Urban Commune'
}, {
'name': 'Triek',
'type': 'Urban Commune'
}, {
'name': 'Kokir',
'type': 'Urban Commune'
}]
}, {
'name': 'Ou Reang Ov',
'communes': [{
'name': 'Ampil Ta Pok',
'type': 'Urban Commune'
}, {
'name': 'Chak',
'type': 'Urban Commune'
}, {
'name': 'Damril',
'type': 'Urban Commune'
}, {
'name': 'Kong Chey',
'type': 'Urban Commune'
}, {
'name': 'Mien',
'type': 'Urban Commune'
}, {
'name': 'Preah Theat',
'type': 'Urban Commune'
}, {
'name': 'Tuol Sophi',
'type': 'Urban Commune'
}]
}, {
'name': 'Ponhea Kraek',
'communes': [{
'name': 'Dountei',
'type': 'Urban Commune'
}, {
'name': 'Kak',
'type': 'Urban Commune'
}, {
'name': 'Kandaol Chrum',
'type': 'Urban Commune'
}, {
'name': 'Kaong Kang',
'type': 'Urban Commune'
}, {
'name': 'Kraek',
'type': 'Urban Commune'
}, {
'name': 'Popel',
'type': 'Urban Commune'
}, {
'name': 'Trapeang Phlong',
'type': 'Urban Commune'
}, {
'name': 'Veal Mlu',
'type': 'Urban Commune'
}]
}, {
'name': 'Tboung Khmum',
'communes': [{
'name': 'Anhchaeum',
'type': 'Urban Commune'
}, {
'name': 'Boeng Pruol',
'type': 'Urban Commune'
}, {
'name': 'Chikor',
'type': 'Urban Commune'
}, {
'name': 'Chirou Ti Muoy',
'type': 'Urban Commune'
}, {
'name': 'Chirou Ti Pir',
'type': 'Urban Commune'
}, {
'name': 'Chob',
'type': 'Urban Commune'
}, {
'name': 'Kor',
'type': 'Urban Commune'
}, {
'name': 'Lngieng',
'type': 'Urban Commune'
}, {
'name': 'Mong Riev',
'type': 'Urban Commune'
}, {
'name': 'Peam Chileang',
'type': 'Urban Commune'
}, {
'name': 'Roka Po Pram',
'type': 'Urban Commune'
}, {
'name': 'Sralab',
'type': 'Urban Commune'
}, {
'name': 'Thma Pechr',
'type': 'Urban Commune'
}, {
'name': 'Tonle Bet',
'type': 'Urban Commune'
}]
}]
}
}]
|
module.exports = {
siteMetadata: {
title: "Benjamin Kleeman",
author: "Benjamin Kleeman",
description: "A personal/portfolio website for Benjamin Kleeman, a web developer and musician."
},
plugins: [
'gatsby-plugin-react-helmet',
{
resolve: `gatsby-plugin-manifest`,
options: {
name: 'benjamin-kleeman-personal-website',
short_name: 'benjamin-kleeman',
start_url: '/',
background_color: '#663399',
theme_color: '#663399',
display: 'standalone',
icon: 'src/images/icon-512x512.png', // This path is relative to the root of the site.
},
},
'gatsby-plugin-sass',
'gatsby-plugin-offline',
],
}
|
import React from 'react';
import PartWidget from './PartWidget';
import DataStore from '../services/DataStore';
class PartsView extends React.Component {
constructor(props) {
super(props);
this.service = new DataStore();
this.vars = {
batchSize: 20
, partsIndex : 0
};
this.loadCategories = this.loadCategories.bind(this);
this.categoryChange = this.categoryChange.bind(this);
this.subcategoryChange = this.subcategoryChange.bind(this);
this.state = {
categoryId: 1
, subcategoryId: 4
, categories: []
, subcategories: []
};
}
loadCategories(){
console.log("going to load categories")
this.service.getCategories((err,os) => {
if(err)
console.log("there is a challenge loading categories", err);
else
this.setState({categories: os})
});
}
categoryChange(event){
event.preventDefault();
console.log("categoryId: %d", this.state.categoryId)
console.log("subcategoryId: %d", this.state.subcategoryId)
let id = parseInt(event.target.value);
console.log("new category id: %d", id)
this.setState({categoryId: id});
this.setState({subcategoryId: 0})
console.log("going to load subcategories from category %d", id)
this.service.getSubcategories(id, (err,os) => {
if(err)
console.log("there is a challenge loading subcategories", err);
else
this.setState({subcategories: os})
});
}
subcategoryChange(event){
event.preventDefault();
console.log("categoryId: %d", this.state.categoryId)
console.log("subcategoryId: %d", this.state.subcategoryId)
let id = parseInt(event.target.value);
this.setState({subcategoryId: id})
console.log("new subcategory: %d", id)
}
componentWillMount() {
this.loadCategories();
if(0 < this.state.categoryId){
this.service.getSubcategories(this.state.categoryId, (err,os) => {
if(err)
console.log("there is a challenge loading subcategories", err);
else
this.setState({subcategories: os})
});
}
}
render(){
return (
<div className="page-element">
<div className="row justify-content-between align-items-center">
<div className="col-6 align-self-end">
<select className="form-control" value={this.state.categoryId} onChange={this.categoryChange}>
<option value={0}>seleccione a categoria</option>
{ this.state.categories.map( (o, i) => <option key={i} value={o.id}>{o.name}</option> ) }
</select>
</div>
<div className="col-6 align-self-end">
<select className="form-control" value={this.state.subcategoryId} onChange={this.subcategoryChange}>
<option value={0}>seleccione a subcategoria</option>
{ this.state.subcategories.map( (o, i) => <option key={i} value={o.id}>{o.name}</option> ) }
</select>
</div>
</div>
</div>
)
}
};
PartsView.defaultProps = { category:null, subcategory:null, selection:null, partsIndex: 0, batchSize: 20 };
export default PartsView;
|
import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk";
import reducer from "./reducer";
import { composeWithDevTools } from "redux-devtools-extension"
const store = createStore(reducer,composeWithDevTools(applyMiddleware(thunk)))
export { store, reducer };
|
import { h } from 'preact';
import PropTypes from 'prop-types';
const ValueContainer = ({ description, shortcut }) => (
<div className="shortcut-select__value">
{description}
<span className="shortcut-select__key">
{shortcut.length > 0 ? shortcut : chrome.i18n.getMessage('notSpecified').toLowerCase()}
</span>
</div>
);
ValueContainer.propTypes = {
description: PropTypes.string,
shortcut: PropTypes.string,
};
ValueContainer.defaultProps = {
description: '',
shortcut: '',
};
export default ValueContainer;
|
/*$(document).ready()方法,jQuery支持我们预定在DOM加载完毕后调用某个函
*数,而不必等待页面中的图像加载。
*/
$(document).ready(
function () {
//获得div 类名poem-stanza的元素
$('div.poem-stanza').addClass('horizontal');
} );
|
//(function(){
var app = angular.module('appHomeWork',[]);
app.controller("SubmitController",function(){
this.user = {};
this.title = "Road TO Angularjs Home Work!!";
this.userlist = [];
this.clearUser = {};
this.add = function(hello){
this.userlist.push(hello);
//hello = this.formValues
console.log(hello.name);
this.user = this.clearUser;
//console.log("Test "+this.userlist[1].name);
};
}) ;
app.controller("SubmitController1",function($scope){
$scope.user = {};
$scope.title = "Road TO Angularjs Home Work!!";
$scope.userlist = [];
$scope.clearUser = {};
$scope.add = function(user){
console.log(user);
$scope.userlist.push(user);
console.log($scope.userlist);
$scope.user = {};
};
$scope.gototab = function(index){
$scope.tab=index;
};
$scope.hellotext = function()
{
alert("Hello World");
};
$scope.del = function(item){
var index=$scope.userlist.indexOf(item);
$scope.userlist.splice(index,1);
}
}) ;
//})();
|
module.exports = function(sequelize, DataType) {
const ItemStatus = sequelize.define('ItemStatus', {
sold : {
type : DataType.STRING,
allowNull : false
}
},
{
tableName : 'status'
});
ItemStatus.associate = function(models) {
ItemStatus.hasOne(models.Item, {
foreignKey : 'is_sold'
});
};
return ItemStatus;
};
|
/**
* Created by Shao Fei on 26/6/2015.
*/
// Factor to compress image
COMPRESS_FACTOR = 0.7;
function processICImage(side) {
var fileInput;
if(side === "front") {
fileInput = "ic_front";
} else if (side === "back") {
fileInput = "ic_back";
}
// Load image and returns <img> element
loadImage(
document.getElementById(fileInput).files[0],
function(img) {
// Compress image to send to server
var compressedImage = compressImage(img);
var directory = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));
$.post('process_ic_image.php',
{
side: side,
img: compressedImage.src
},
function(data, status) {
var results = JSON.parse(data);
fillInForms(results, side);
console.log(data);
});
}
)
}
function compressImage(img) {
var canvasFullIC = document.createElement("CANVAS");
canvasFullIC.setAttribute("width", img.width * COMPRESS_FACTOR);
canvasFullIC.setAttribute("height", img.height * COMPRESS_FACTOR);
var contextFullIC = canvasFullIC.getContext("2d");
contextFullIC.drawImage(img, 0, 0, img.width * COMPRESS_FACTOR, img.height * COMPRESS_FACTOR);
var compressedImage = new Image();
compressedImage.src = canvasFullIC.toDataURL("image/jpeg");
return compressedImage;
}
function fillInForms(results, side) {
if(side === "front") {
var fullNameField = document.forms["user_registration_form"]["fullname"];
fullNameField.value = results.nric;
var nricField = document.forms["user_registration_form"]["nric"];
nricField.value = results.name;
var dobField = document.forms["user_registration_form"]["birthday"];
dobField.value = convertDateString(results.dob);
fillGender(results.gender);
fillRace(results.race);
}
if(side === "back") {
var addressField = document.forms["user_registration_form"]["address"];
address.innerHTML = results.address;
}
}
function convertDateString(dateStringDDMMYYYY) {
var dateData = dateStringDDMMYYYY.split("-");
var day = dateData[0];
var month = dateData[1];
var year = dateData[2];
var convertedDate = new Date(year, month, day);
return convertedDate.toDateString();
}
function fillGender(gender) {
if(gender === "M") {
document.getElementById("female").checked = false;
document.getElementById("male").checked = true;
} else if(gender === "F") {
document.getElementById("male").checked = false;
document.getElementById("female").checked = true;
}
}
function fillRace(race) {
var raceSelect = document.getElementById("race");
if(race === "CHINESE") {
raceSelect.selectedIndex = 1;
} else if(race === "MALAY") {
raceSelect.selectedIndex = 2;
} else if(race === "INDIAN") {
raceSelect.selectedIndex = 3;
} else {
raceSelect.selectedIndex = 4;
document.getElementById("otherRaceInput").value = race;
}
}
|
import BootState from './phaser/states/Boot';
import PreloadState from './phaser/states/Preload';
class Game extends Phaser.Game {
constructor(location = null) {
const gameWrapper = document.getElementById(location);
const width = 200;
const height = 200;
super(width, height, Phaser.CANVAS, gameWrapper, null);
this.state.add('Boot', BootState);
this.state.add('Preload', PreloadState);
this.state.start('Boot');
}
}
window.onload = () => {
const MyGame = new Game('game-wrapper');
MyGame.state.onStateChange.add((newState, previousState) => {
console.log(`${newState} state has loaded`);
});
}
|
import searchActionTypes from './search.types'
import axios from "axios";
export const onSearchChange = character => ({
type: searchActionTypes.SEARCH_START,
payload: character
})
export const searchSuccess = targetUser => ({
type: searchActionTypes.SEARCH_SUCCESS,
payload: targetUser
})
export const allUser = () => {
return async dispatch => {
let url ='/search/all-user';
await axios.get(url)
.then(response => {
console.log(response.data);
dispatch(searchSuccess(response.data.user));
})
.catch(err => {
// handle error
console.log("error = " + err);
});
}
}
|
import React from 'react'
const FoodItem = (props) => {
return(
<div>
<h5>{props.item.foodName}</h5>
<p>{props.item.ingredients}</p>
<p><strong>{props.item.price}</strong></p>
</div>
)
}
export default FoodItem
|
movieDBApp.controller('LoginController', function LoginController($scope, $timeout, $location, loginService) {
$scope.user = {};
$scope.message = '';
$scope.clear = () => {
$scope.user = {};
}
$scope.login = () => {
console.log("User saved scope:", $scope.user);
loginService.login($scope.user, (res) => {
//Success
console.log("Success:", res);
$scope.message = "You are successfully logged in! You will be redirected in 3 sec...";
$timeout(() => $location.url('/movies'), 3000);
}, (error) => {
//Failure
console.log("Error:", error);
$scope.message = "Wrong username/password";
});
$scope.user = {};
}
});
|
var canvas;
$(document).ready(function()
{
canvas = document.getElementById("logo");
if (canvas.getContext)
{
drawLogo();
}
});
function drawLogo()
{
var context = canvas.getContext('2d');
context.fillStyle = "#f00";
context.strokeStyle = "#f00";
context.font = 'italic 40px sans-serif';
context.textBaseline = 'top';
context.fillText('AwesomeCo', 60, 0);
context.lineWidth = 2;
context.beginPath();
context.moveTo(0, 40);
context.lineTo(30, 0);
context.lineTo(60, 40);
context.lineTo(285, 40);
context.stroke();
context.closePath();
}
|
import { createServer } from 'http'
import React from 'react'
import Stroop from '../shared/stroop'
import getRandomColorName from '../shared/getRandomColorName'
const server = createServer()
server.on('request', (req, res) => {
const data = {
color: getRandomColorName(),
name: getRandomColorName()
}
const stroop = React.renderToString(
<Stroop name={data.name} color={data.color} />
)
const html = React.renderToStaticMarkup(
<html>
<body>
<div id='app' dangerouslySetInnerHTML={{__html: stroop}} />
</body>
</html>
)
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
res.end('<!doctype html>' + html)
})
server.listen(3000)
|
const getEmailIndex = require("./appointmentUtil");
class Appointment{
constructor(start,end){
this.start = start;
this.end = end;
this.maxAttendees = 10;
this.attendees = [];
}
setId(id){
this.id = id;
}
addAttendee(name, email){
let today = new Date();
if(this.isAvailable() && today <= this.start){
this.attendees.push({name,email});
}else{
console.log("Sorry, you should not be able to add an attendee after the appointment `start` datetime or the spot is full");
}
}
removeAttendee(email){
let index = getEmailIndex(this.attendees, email);
if(index != -1){//email is correct
this.attendees.splice(index, 1);
}else{
console.log("Sorry, the email doesn't exist.")
}
}
remainingSpots(){
return this.maxAttendees-this.attendees.length;
}
isAvailable(){
let today = new Date();
if(this.remainingSpots()>=1 && today <= this.start){
return true;
}else{
return false;
}
}
isConfirmed(){
if(this.attendees.length>=1){
return true;
}else{
return false;
}
}
}
module.exports = Appointment
|
import { SET_NOTIFICATION } from "config/constants";
const initState = {
loading: false,
notifications: [],
};
const appReducer = (state = initState, action) => {
switch (action.type) {
case SET_NOTIFICATION:
const notfs = state.notifications.slice();
notfs.unshift(action.payload);
return {
...state,
notifications: notfs,
};
default:
return state;
}
};
export default appReducer;
|
var CallidForm;
var pageSize = 25;
/**********************************************************************站臺管理主頁面**************************************************************************************/
//站臺管理Model
Ext.define('gigade.Sites', {
extend: 'Ext.data.Model',
fields: [
{ name: "site_id", type: "int" },
{ name: "site_name", type: "string" },
{ name: "domain", type: "string" },
{ name: "cart_delivery", type: "string" },
{ name: "csitename", type: "string" },
{ name: "online_user", type: "int" },
{ name: "max_user", type: "int" },
{ name: "page_location", type: "string" },
{ name: "site_status", type: "string" },
{ name: "site_createdate", type: "string" },
{ name: "site_updatedate", type: "string" },
{ name: "create_userid", type: "string" },
{ name: "update_userid", type: "string" }
]
});
var SitesStore = Ext.create('Ext.data.Store', {
autoDestroy: true,
pageSize: pageSize,
model: 'gigade.Sites',
proxy: {
type: 'ajax',
url: '/Element/SiteList',
reader: {
type: 'json',
root: 'data',
totalProperty: 'totalCount'
}
}
// autoLoad: true
});
SitesStore.on('beforeload', function () {
Ext.apply(SitesStore.proxy.extraParams,
{
serchcontent: Ext.getCmp('serchcontent').getValue()
});
});
var sm = Ext.create('Ext.selection.CheckboxModel', {
listeners: {
selectionchange: function (sm, selections) {
Ext.getCmp("gdSites").down('#edit').setDisabled(selections.length == 0);
// Ext.getCmp("gdFgroup").down('#remove').setDisabled(selections.length == 0);
// Ext.getCmp("gdFgroup").down('#auth').setDisabled(selections.length == 0);
// Ext.getCmp("gdFgroup").down('#callid').setDisabled(selections.length == 0);
}
}
});
function Query(x) {
if (Ext.getCmp("serchcontent").getValue() != "") {
SitesStore.removeAll();
Ext.getCmp("gdSites").store.loadPage(1, {
params: {
serchcontent: Ext.getCmp('serchcontent').getValue()
}
});
}
else {
Ext.Msg.alert(INFORMATION, SEARCH_LIMIT);
}
}
Ext.onReady(function () {
var gdSites = Ext.create('Ext.grid.Panel', {
id: 'gdSites',
store: SitesStore,
width: document.documentElement.clientWidth,
columnLines: true,
frame: true,
columns: [
{ header: SITEID, dataIndex: 'site_id', width: 60, align: 'center' },
{ header: SITENAME, dataIndex: 'site_name', width: 150, align: 'center' },
{ header: DOMAIN, dataIndex: 'domain', width: 200, align: 'center' },
{ header: SCATEDELIVERYID, dataIndex: 'cart_delivery', width: 150, align: 'center', hidden: true },
{ header: SCATEDELIVERY, dataIndex: 'csitename', width: 150, align: 'center' },
{ header: ONLINEUSER, dataIndex: 'online_user', width: 80, align: 'center' },
{ header: MAXUSER, dataIndex: 'max_user', width: 80, align: 'center' },
{ header: PAGELOCATION, dataIndex: 'page_location', width: 200, align: 'center' },
{ header: BANNERCREATE, dataIndex: 'site_createdate', width: 150, align: 'center' },
{ header: BANNERUPDATE, dataIndex: 'site_updatedate', width: 150, align: 'center' },
{
header: "狀態", dataIndex: 'site_status', width: 60, align: 'center',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == 1) {
return "<a href='javascript:void(0);' onclick='UpdateActive(" + record.data.site_id + ")'><img hidValue='0' id='img" + record.data.site_id + "' src='../../../Content/img/icons/accept.gif'/></a>";
}
else {
return "<a href='javascript:void(0);' onclick='UpdateActive(" + record.data.site_id + ")'><img hidValue='1' id='img" + record.data.site_id + "' src='../../../Content/img/icons/drop-no.gif'/></a>";
}
}
}
],
tbar: [
{ xtype: 'button', text: ADD, id: 'add', hidden: false, iconCls: 'icon-user-add', handler: onAddClick },
{ xtype: 'button', text: EDIT, id: 'edit', hidden: false, iconCls: 'icon-user-edit', disabled: true, handler: onEditClick },
'->',
{
xtype: 'textfield', allowBlank: true, id: 'serchcontent', name: 'serchcontent', fieldLabel: SITENAME, labelWidth: 60, listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
Query(1);
}
}
}
},
{
xtype: 'button',
text: SEARCH,
iconCls: 'icon-search',
id: 'btnQuery',
handler: Query
},
{
xtype: 'button',
text: RESET,
id: 'btn_reset',
listeners: {
click: function () {
Ext.getCmp("serchcontent").setValue("");
//Query(1);
}
}
}
],
bbar: Ext.create('Ext.PagingToolbar', {
store: SitesStore,
pageSize: pageSize,
displayInfo: true,
displayMsg: NOW_DISPLAY_RECORD + ': {0} - {1}' + TOTAL + ': {2}',
emptyMsg: NOTHING_DISPLAY
}),
listeners: {
scrollershow: function (scroller) {
if (scroller && scroller.scrollEl) {
scroller.clearManagedListeners();
scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
}
}
},
selModel: sm
});
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [gdSites],
renderTo: Ext.getBody(),
autoScroll: true,
listeners: {
resize: function () {
gdSites.width = document.documentElement.clientWidth;
this.doLayout();
}
}
});
ToolAuthority();
// SitesStore.load({ params: { start: 0, limit: 25 } });
});
/*************************************************************************************新增*************************************************************************************************/
onAddClick = function () {
//addWin.show();
editFunction(null, SitesStore);
}
/*************************************************************************************編輯*************************************************************************************************/
onEditClick = function () {
var row = Ext.getCmp("gdSites").getSelectionModel().getSelection();
//alert(row[0]);
if (row.length == 0) {
Ext.Msg.alert(INFORMATION, NO_SELECTION);
} else if (row.length > 1) {
Ext.Msg.alert(INFORMATION, ONE_SELECTION);
} else if (row.length == 1) {
editFunction(row[0], SitesStore);
}
}
//更改會員狀態(啟用或者禁用)
function UpdateActive(id) {
var activeValue = $("#img" + id).attr("hidValue");
$.ajax({
url: "/Element/UpdateSiteState",
data: {
"id": id,
"active": activeValue
},
type: "POST",
dataType: "json",
success: function (msg) {
if (activeValue == 1) {
$("#img" + id).attr("hidValue", 0);
$("#img" + id).attr("src", "../../../Content/img/icons/accept.gif");
SitesStore.load();
}
else {
$("#img" + id).attr("hidValue", 1);
$("#img" + id).attr("src", "../../../Content/img/icons/drop-no.gif");
SitesStore.load();
}
},
error: function (msg) {
Ext.Msg.alert(INFORMATION, FAILURE);
SitesStore.load();
}
});
}
|
import React from 'react';
import { connect } from 'react-redux';
import { usernameInput, passwordInput, goToPage, input } from '../store/actions';
import { api, Api } from '../apiUrl';
import axios from 'axios';
import qs from 'qs';
const mapStateToProps = (state) => {
return {
username: state.username,
password: state.password
};
};
const mapDispatchToProps = (dispatch) => {
return {
onInput: (name, newValue) => { dispatch(input(name, newValue)); },
onUsernameChange: (newValue) => { dispatch(usernameInput(newValue)); },
onPasswordChange: (newValue) => { dispatch(passwordInput(newValue)); },
onSubmit: (username, password) => {
console.log(`sending ${username} ${password}`);
Api.login(username, password)
.then((response) => {
console.log(response);
dispatch(goToPage('main'));
})
.catch((err) => {
if (err.response.status === 401) {
alert('Wrong username or password try again');
}
console.dir(err);
})
},
goToPage: (pageName) => {
dispatch(goToPage(pageName));
}
};
};
let Login = ({ dispatch, username, password, onInput, onSubmit, goToPage }) => (
<div className="login-page">
<form className="login-form">
<div className="username-container">
<label className="input-label" htmlFor="username-field">Username : </label>
<input value={username} onChange={e => { onInput('username', e.target.value) } } id="username-field" type="text"/>
</div>
<div className="password-container">
<label className="input-label" htmlFor="password-field">Password :</label>
<input value={password} onChange={e => { onInput('password', e.target.value) } } id="password-field" type="password"/>
</div>
<button className="login-button" type="submit" onClick={e => { e.preventDefault(); onSubmit(username, password); } }>Login</button>
</form>
<button className="signup-button" onClick={ e => { goToPage('signup'); } }>Sign Up</button>
</div>
)
Login = connect(mapStateToProps, mapDispatchToProps)(Login);
export default Login;
|
import React, {useState} from 'react';
import {AgGridColumn, AgGridReact} from 'ag-grid-react';
import 'ag-grid-community/dist/styles/ag-grid.css';
import 'ag-grid-community/dist/styles/ag-theme-alpine.css';
import RowGroupingModule from 'ag-grid-community';
import classes from "./Grid2.module.css";
const Grid2 = () => {
const [gridApi, setGridApi] = useState();
const columnDefs = [
{headerName: "ID", field: "id", checkboxSelection: true, headerCheckboxSelection: true},
{headerName: "Title", field: "title"},
{headerName: "URL", field: "url"},
{headerName: "Thumbnail", field: "thumbnailUrl", cellRenderer: "imgRenderer", filter: false, floatingFilter: false}
];
const defaultColDef = {
sortable: true,
editable: true,
flex: 1,
filter: true,
floatingFilter: true
}
function onGridReady(params) {
setGridApi(params);
fetch("https://jsonplaceholder.typicode.com/photos")
.then(res => res.json())
.then(res => {
params.api.applyTransaction({add: res}); //adding API data to grid
// params.api.paginationGoToPage(10);
});
}
function onPaginationChange(pageSize) {
gridApi.api.paginationSetPageSize(Number(pageSize));
}
function ImgRenderer(props) {
return <img src={props.value} style={{width: "50%"}} />
}
return (
<div className={classes.Grid2}>
<h1 align="center">Color Display</h1>
<div className={classes.HeaderRow}>
<h3>Color Details</h3>
<select onChange={(event) => onPaginationChange(event.target.value)}>
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</div>
<div className="ag-theme-alpine" style={{height: "400px"}}>
<AgGridReact
columnDefs={columnDefs}
defaultColDef={defaultColDef}
frameworkComponents={{imgRenderer: ImgRenderer}}
onGridReady={onGridReady}
pagination={true}
paginationPageSize={10}
// paginationAutoPageSize={true}
>
</AgGridReact>
</div>
</div>
);
}
export default Grid2;
|
import VueDatamaps from './components/Datamaps.vue'
if (typeof window !== 'undefined' && window.Vue) window.Vue.use(VueDatamaps)
export {
VueDatamaps
}
export default (Vue) => {
Vue.component(VueDatamaps.name, VueDatamaps)
}
|
import Creators from './actions';
import sActions from '../../../socket/actions';
import { roomOperations } from '../../loading_room/duck';
const setGameState = Creators.setGameState;
const rotateShip = Creators.rotateShip;
const SHIP_MAP = {
'carrier': 5,
'battleship': 4,
'cruiser': 3,
'submarine': 2,
totalShips: 6
};
const takeTurn = (id) => {
return (dispatch, getState) => {
let finished = getState().bs.game.finished;
let turnTaken = getState().room.room.turnTaken;
if (finished || turnTaken) {
return;
}
dispatch(roomOperations.turnTaken(true));
let opponentState = {};
let playerState = {};
let playerOneState = getState().bs.game.playerOneState;
let playerTwoState = getState().bs.game.playerTwoState;
let username = getState().home.auth.user.username;
let currentPlayer = getState().room.room.currentPlayerIndex;
if (playerOneState.username === username) {
playerState = {...playerOneState};
opponentState = {...playerTwoState};
} else {
playerState = {...playerTwoState};
opponentState = {...playerOneState};
}
let status = checkStatus(id, currentPlayer, opponentState, playerState);
let payload = {};
if (playerOneState.username === username) {
payload.playerOneState = {...playerState};
} else {
payload.playerTwoState = {...playerState};
}
if (status.end) {
dispatch(sActions.sUpdateGameState(payload));
dispatch(sActions.sEndGame(status));
} else {
dispatch(sActions.sUpdateGameState(payload));
if (status.shipDestroyed || status.shipHit) {
dispatch(roomOperations.turnTaken(false));
if (status.shipDestroyed) {
dispatch(roomOperations.displayAlert(true, "Opponent ship has been destroyed"));
}
} else if (!status.shipHit && !status.shipDestroyed) {
dispatch(sActions.sEndTurn());
}
}
}
}
const checkStatus = (id, currentPlayer, opponentState, playerState) => {
let hit = Object.keys(opponentState.placedShips).find(key => opponentState.placedShips[key].includes(id));
let hitSquares = playerState.hitSquares ? playerState.hitSquares : [];
if (hit) {
let numHit = playerState[hit] ? playerState[hit] : 0;
let shipsDestroyed = playerState.shipsDestroyed ? playerState.shipsDestroyed : [];
hitSquares.push({ id: id, ship: true });
playerState.hitSquares = hitSquares;
playerState[hit] = numHit + 1;
let shipName = hit;
if (/\d/.test(shipName)) {
shipName = shipName.slice(0, -2);
}
if (SHIP_MAP[shipName] === playerState[hit]) {
shipsDestroyed.push(hit);
playerState.shipsDestroyed = shipsDestroyed;
if (playerState.shipsDestroyed.length === SHIP_MAP.totalShips) {
return { end: true, winner: currentPlayer };
}
return { end: false, winner: null, shipDestroyed: true };
}
return { end: false, winner: null, shipHit: true };
} else {
hitSquares.push({ id: id, ship: false });
playerState.hitSquares = hitSquares;
}
return { end: false, winner: null };
}
const selectShip = (id) => {
return (dispatch, getState) => {
let placedShips = getState().bs.arrange.placedShips;
if (placedShips[id] && placedShips[id].length > 0) {
let placedShips = getState().bs.arrange.placedShips;
let updated = {...placedShips};
delete updated[id];
dispatch(Creators.updatePlacedShips(updated));
}
dispatch(Creators.setHoverSquares([], true));
dispatch(Creators.displayReadyButton(false));
dispatch(Creators.selectShip(id));
}
}
const showShip = (hoveredSquareId) => {
return (dispatch, getState) => {
let id = getState().bs.arrange.shipSelected;
if (id === null) {
return;
}
let horizontal = getState().bs.arrange.horizontal;
let isValidHover = true;
let hoverSquares = [];
if (/\d/.test(id)) {
id = id.slice(0, -2);
}
let placedShips = getState().bs.arrange.placedShips;
let keys = Object.keys(placedShips);
for (let i = 0; i < SHIP_MAP[id]; i++) {
let square = 0;
if (horizontal) {
square = hoveredSquareId + i;
if (square % 11 === 0) {
isValidHover = false;
break;
}
} else {
square = hoveredSquareId + (11 * i);
if (square > 121) {
isValidHover = false;
break;
}
}
if (keys.find(key => placedShips[key].includes(square))) {
isValidHover = false;
}
hoverSquares.push(square);
}
dispatch(Creators.setHoverSquares(hoverSquares, isValidHover));
}
}
const placeShip = () => {
return (dispatch, getState) => {
let isValidHover = getState().bs.arrange.isValidHover;
let shipSelected = getState().bs.arrange.shipSelected;
if (!isValidHover || shipSelected === null) {
return;
}
let hoverSquares = getState().bs.arrange.hoverSquares;
let placedShips = getState().bs.arrange.placedShips;
let updated = Object.assign({}, placedShips, {
[shipSelected]: hoverSquares
});
dispatch(Creators.updatePlacedShips(updated));
dispatch(Creators.selectShip(null));
let numPlaced = Object.keys(updated).length;
if (numPlaced === SHIP_MAP.totalShips) {
dispatch(Creators.displayReadyButton(true));
}
}
}
const ready = () => {
return (dispatch, getState) => {
let state = {
username: getState().home.auth.user.username,
placedShips: getState().bs.arrange.placedShips
}
dispatch(Creators.displayReadyButton(false));
dispatch(Creators.finishShipArrange());
dispatch(sActions.sUpdateGameState(state));
}
}
const reset = () => {
return (dispatch) => {
dispatch(Creators.reset());
dispatch(Creators.resetArrange());
dispatch(Creators.resetUI());
}
}
export default {
setGameState,
takeTurn,
reset,
selectShip,
rotateShip,
showShip,
placeShip,
ready
}
|
import axios from 'axios';
class AnuncioService {
search(productName) {
return axios.get(`https://api.mercadolibre.com/sites/MLB/search?q=${productName}`)
.then(res => {
let results = res.data.results;
//console.log(results);
//this.setState({ results, loading : false });
})
.catch(err => {
});
}
}
export default AnuncioService;
|
'use strict';
const mysqlConfig = {
host : 'localhost' ,
database : 'flowburDevelopment' ,
password : 'dixit.sharma@click-labs.com' ,
user : 'root' ,
debug : false ,
port : 3306 ,
multipleStatements : true
};
var mongoDatabase = null;
var env = environment || "Dev";
if (env == "production") {
mongoDatabase = process.env.MONGO_DBNAME_LIVE
} else {
if (env == "testing") {
mongoDatabase = process.env.MONGO_DBNAME_TEST
} else {
if (env == "development") {
mongoDatabase = process.env.MONGO_DBNAME_DEV || 'futran-dev'
}
}
}
var mongoPort = process.env.port || 27017,
mongoHost = 'localhost',
mongoUserPass = process.env.MONGO_USER && process.env.MONGO_PASS ? process.env.MONGO_USER + ":" + process.env.MONGO_PASS + "@" : '';
var mongo = {
URI: "mongodb://" + mongoUserPass + mongoHost + ":" + mongoPort + "/" + mongoDatabase,
port: 27017,
database: mongoDatabase
};
module.exports = {
mongoConfig : mongo
};
|
/* jshint indent: 2 */
module.exports = function(sequelize, DataTypes) {
return sequelize.define('geo_project', {
id: {
type: DataTypes.INTEGER(11),
allowNull: false,
primaryKey: true,
autoIncrement: true
},
departmentId: {
type: DataTypes.INTEGER(11),
allowNull: false,
references: {
model: 'department',
key: 'id'
}
},
projectNumber: {
type: DataTypes.STRING,
allowNull: false
},
name: {
type: DataTypes.STRING,
allowNull: false
},
address1: {
type: DataTypes.STRING,
allowNull: true
},
address2: {
type: DataTypes.STRING,
allowNull: true
},
postCode: {
type: DataTypes.STRING,
allowNull: true
},
city: {
type: DataTypes.STRING,
allowNull: true
},
country: {
type: DataTypes.STRING,
allowNull: false
},
deleted: {
type: DataTypes.INTEGER(1),
allowNull: false,
defaultValue: "0"
},
geoClientId: {
type: DataTypes.INTEGER(11),
allowNull: true,
references: {
model: 'geo_client',
key: 'id'
}
},
projectLeaderId: {
type: DataTypes.INTEGER(11),
allowNull: false
},
currency: {
type: DataTypes.ENUM('SEK','DKK','NOK','EUR','USD'),
allowNull: true
},
units: {
type: DataTypes.ENUM('metric','imperial'),
allowNull: false,
defaultValue: "metric"
}
}, {
tableName: 'geo_project'
});
};
|
var s = Snap("#svg");
// Lets create big circle in the middle:
var bigCircle = s.circle(150, 150, 100);
// By default its black, lets change its attributes
bigCircle.attr({
fill: "#bada55",
stroke: "#000",
strokeWidth: 5
});
var smallCircle = s.circle(100, 150, 70);
// Lets put this small circle and another one into a group:
var discs = s.group(smallCircle, s.circle(200, 150, 70));
// Now we can change attributes for the whole group
discs.attr({
fill: "#fff"
});
// Now more interesting stuff
// Lets assign this group as a mask for our big circle
bigCircle.attr({
mask: discs
});
smallCircle.animate({r: 50}, 1000).loop();
|
var express = require('express');
var router = express.Router();
var passport = require('passport');
var logger = require('@ekhanei/logger').getLogger();
var sdk = require('@ekhanei/sdk');
var utils = require('@ekhanei/utils');
var requireLogin = require('../middleware/require-login');
// All account routes require login
router.use('/', requireLogin);
/**
* Change phone number
*/
router.post('/phone', function(req, res, next) {
// Validate input
var invalid = req.validateForm(global.validate.updatePhone);
// Is invalid?
if (invalid) {
req.flash('errors', invalid.errors);
req.flash('form', req.body);
return res.redirect('/profile/me#changephone');
}
var oldPhone = req.body.old_phone,
newPhone = req.body.new_phone;
// Verify current (old) phone number
if (oldPhone != req.user.phone) {
req.flash('errors', {
old_phone: req.i18n.__("This is not your current number")
});
req.flash('form', req.body);
return res.redirect('/profile/me');
}
// Make sure the two numbers are not the same
if (oldPhone === newPhone) {
req.flash('errors', {
new_phone: req.i18n.__("Cannot be the same number")
});
req.flash('form', req.body);
return res.redirect('/profile/me');
}
// Send to API
sdk.account.update({
id: req.user.id,
jwt: req.user.jwt,
ip: req.getClientIP(),
data: {
phone: newPhone
}
})
.then(function(response) {
req.handlePigeonResponse(response);
logger.debug('User changed phone number. Needs verification.', {
userID: req.user.id,
oldPhone: oldPhone,
newPhone: newPhone
});
// Store unverified data in session in the same format
// as an unverified registration. This can be used
// again even if the user doesn't verify their account
// right now.
req.session.unverified = {
id: req.user.id,
name: req.user.name,
jwt: req.user.jwt,
phone: newPhone
};
return res.redirect('/profile/me#verifyphone');
})
.catch(function(err) {
// If the new phone number already exists
if (err.is(sdk.account.errors.ACCOUNT_EXISTS)) {
req.flash('errors', {
new_phone: req.i18n.__("Number is already in use")
});
req.flash('form', req.body);
return res.redirect('/profile/me');
}
req.flash('errors', {
new_phone: req.i18n.__("Can't update phone number")
});
req.flash('form', req.body);
return res.redirect('/profile/me');
});
});
/**
* For verification routes we should make sure the user is
* unverified.
*/
router.use('/phone/verify', function(req, res, next) {
if (!req.session.unverified) {
req.flash('errors', {
new_phone: req.i18n.__("Can't update phone number, session expired")
});
// Send them back to the new phone number interface
return res.redirect('/profile/me');
}
next();
});
/**
* Do phone number verification
*/
router.post('/phone/verify', function(req, res, next) {
var unverified = req.session.unverified;
// Submit the OTP
sdk.account.update({
id: req.user.id,
data: {
status: 'verified',
otp: req.body.otp,
userAgent: req.headers['user-agent'],
source: 'smartphone'
},
ip: req.getClientIP(),
jwt: req.user.jwt
})
// If successfully updated
.then(function(response) {
req.handlePigeonResponse(response);
// Update the user payload
req.user.phone = unverified.phone;
req.session.unverified = null;
req.flash('info', req.i18n.__("Your mobile number has been updated"));
res.redirect('/profile/me');
})
// Error updating account
.catch(function(err) {
if (err.is(sdk.account.errors.WRONG_OTP)) {
req.flash('errors', {
otp: req.i18n.__("Incorrect verification code")
});
return res.redirect('/profile/me#verifyphone');
}
next(err);
});
});
// Re-send phone number verification OTP
router.get('/phone/verify/resend', function (req, res, next) {
sdk.account.update({
id: req.session.unverified.id,
jwt: req.session.unverified.jwt,
ip: req.getClientIP(),
data: {
phone: req.session.unverified.phone
}
})
// OTP verified, get JWT and next step
.then(function (response) {
req.handlePigeonResponse(response);
return res.send({
message: req.i18n.__("Verification code sent")
});
})
.catch(function (err) {
req.flash('error', req.i18n.__("Something wrong with verification code"));
return res.redirect('/profile/me');
});
});
/**
* Change password
* */
router.post('/password', function(req, res, next) {
// Schema validation
var invalid = req.validateForm(global.validate.changePassword);
if (invalid) {
req.flash('errors', invalid.errors);
return res.redirect('/profile/me#changepassword');
}
// Confirm password
if (req.body.new_password !== req.body.confirm_password) {
req.flash('error', req.i18n.__("Your new password did not match the confirmation. Please try again."));
return res.redirect('/profile/me');
}
sdk.account.update({
id: req.user.id,
jwt: req.user.jwt,
ip: req.getClientIP(),
data: {
old_password: req.body.old_password,
password: req.body.new_password,
phone: req.user.phone
}
})
.then(function(response) {
req.user.xmpp.password = utils.aesEncrypt(req.body.new_password, process.env.AES_SECRET);
req.handlePigeonResponse(response);
req.flash('info', req.i18n.__("Your password was successfully changed"));
res.redirect('/profile/me');
})
.catch(function(err) {
// If the old password was incorrect
if (err.is(sdk.account.errors.WRONG_PASSWORD)) {
req.flash('error', req.i18n.__("Your current password was incorrect, please try again."));
return res.redirect('/profile/me');
}
next(err);
});
});
// Confirm delete account
router.post('/delete', function(req, res, next) {
// No password supplied
if (!req.body.password) {
req.flash('errors', { password: req.i18n.__("You must enter your password") });
return res.redirect('/profile/me');
}
// Check password
var password = utils.aesDecrypt(req.user.xmpp.password, process.env.AES_SECRET);
if (password !== req.body.password) {
req.flash('errors', { password: req.i18n.__("Incorrect password") });
return res.redirect('/profile/me');
}
// Password matches. Now delete the user's account.
sdk.account.delete({
id: req.user.id,
jwt: req.user.jwt,
ip: req.getClientIP()
})
// Account was deleted. Logout and redirect.
.then(function(response) {
req.handlePigeonResponse(response);
// Logout with Passport
req.logout();
// Clear all custom session data
req.session.regenerate(function(err) {
if (err) { throw err; }
req.flash('info', req.i18n.__("We're sorry to see you go! Your account has been deleted and you are now logged out."));
res.redirect('/');
});
})
.catch(function(err) {
next(err);
});
});
module.exports = router;
|
import reactDom from 'react-dom';
import './topbar.css';
import {Link} from "react-router-dom";
export default function TopBar() {
return (
<div className ="top">
<div className = "topLeft">
<i className="topIcon fab fa-facebook-square"></i>
<i className="topIcon fab fa-twitter-square"></i>
<i className="topIcon fab fa-instagram-square"></i>
<i className="topIcon fab fa-pinterest-square"></i>
</div>
<div className = "topCenter">
<ul className="topList">
<li className="topListItem">
<Link to ="/">Home</Link>
</li>
<li className="topListItem"> <Link to ="/">About Us</Link> </li>
<li className="topListItem"> Contact </li>
<li className="topListItem"> <Link to ="/blogs">Blogs</Link> </li>
<li className="topListItem"> Logout </li>
</ul>
</div>
<div className = "topRight">
<ul className="topList">
<li className="topListItem">
<Link to ="/login">Login</Link>
</li>
<li className="topListItem"> <Link to ="/register">Register</Link> </li>
<li className="topListItem"> Logout </li>
</ul>
<img
className ="topImg"
src ="https://as1.ftcdn.net/v2/jpg/03/46/83/96/1000_F_346839683_6nAPzbhpSkIpb8pmAwufkC7c5eD7wYws.jpg"
alt="Not found"
/>
<i className = "topIcon fas fa-search"></i>
</div>
</div>
)
}
|
import React from 'react';
import PropTypes from 'prop-types';
import { Tail } from 'tail';
import os from 'os';
import { shell } from 'electron';
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';
import Container from 'react-bootstrap/Container';
import Alert from 'react-bootstrap/Alert';
import Button from 'react-bootstrap/Button';
const logStyle = {
whiteSpace: 'pre-line',
maxHeight: '700px',
overflowY: 'scroll',
};
class LogDisplay extends React.Component {
constructor(props) {
super(props);
this.content = React.createRef();
}
componentDidUpdate() {
this.content.current.scrollTop = this.content.current.scrollHeight;
}
render() {
return (
<Col ref={this.content} style={logStyle}>
{this.props.logdata}
</Col>
);
}
}
LogDisplay.propTypes = {
logdata: PropTypes.string
}
export class LogTab extends React.Component {
constructor(props) {
super(props);
this.state = {
logdata: ''
}
this.tail = null;
this.handleOpenWorkspace = this.handleOpenWorkspace.bind(this);
}
componentDidUpdate(prevProps) {
// if there is a logfile and it's new, start tailing the file.
if (this.props.logfile && prevProps.logfile !== this.props.logfile) {
try {
this.tail = new Tail(this.props.logfile, {
fromBeginning: true
});
let logdata = Object.assign('', this.state.logdata);
this.tail.on('line', (data) => {
logdata += `${data}` + os.EOL
this.setState({ logdata: logdata })
})
} catch(error) {
// in case a recent session was loaded but the logfile
// no longer exists
this.setState({logdata: `Logfile is missing: ${os.EOL}${this.props.logfile}`})
console.log(error)
console.log(`Not able to read ${this.props.logfile}`)
}
// No new logfile. No existing logdata.
} else if (this.state.logdata === '') {
this.setState({logdata: 'Starting...'})
// No new logfile. Existing logdata. Invest process exited.
} else if (['success', 'error'].includes(this.props.jobStatus)) {
try {
this.tail.unwatch()
}
catch(error) {
console.log(error)
}
}
}
handleOpenWorkspace() {
shell.showItemInFolder(this.props.logfile)
}
render() {
let RenderedAlert;
const WorkspaceButton = <Button className='float-right float-bottom'
variant='outline-dark'
onClick={this.handleOpenWorkspace}
disabled={this.props.jobStatus === 'running'}>
Open Workspace
</Button>
if (this.props.jobStatus === 'error') {
RenderedAlert = <Alert className='py-4 mt-3'
variant={'danger'}>
{this.props.logStdErr}
{WorkspaceButton}
</Alert>
} else if (this.props.jobStatus === 'success') {
RenderedAlert = <Alert className='py-4 mt-3'
variant={'success'}>
<span>Model Completed</span>
{WorkspaceButton}
</Alert>
}
return (
<Container>
<Row>
<LogDisplay logdata={this.state.logdata}/>
</Row>
<Row>
<Col>
{RenderedAlert}
</Col>
</Row>
</Container>
);
}
}
LogTab.propTypes = {
jobStatus: PropTypes.string,
logfile: PropTypes.string,
logStdErr: PropTypes.string
}
|
import React from "react";
import day from "./day";
function WeatherDay({ weatherForecast, setWeatherPerDay }) {
// weatherForecast const que almacena la respuesta de la api de la funcion getWeatherForecastFor5Days
// optenemos datos del clima de 5 dias futuros con lapsos de 3 horas , retorna un array de 40 elementos , 8 por dia
// const date = new Date();
// const currentDay = date.getDay();
const dia0 = weatherForecast.list.slice(0, 8);
const dia1 = weatherForecast.list.slice(8, 16);
const dia2 = weatherForecast.list.slice(16, 24);
const dia3 = weatherForecast.list.slice(24, 32);
const dia4 = weatherForecast.list.slice(32, 40);
const element0 = document.getElementById("element0");
const element1 = document.getElementById("element1");
const element2 = document.getElementById("element2");
const element3 = document.getElementById("element3");
const element4 = document.getElementById("element4");
function clearStyle() {
const todos = document.querySelectorAll(".weather-day");
todos.forEach((tag) => {
tag.classList.remove("is-active");
});
}
function printDataByDate0() {
setWeatherPerDay(dia0);
clearStyle();
element0.classList.add("is-active");
}
function printDataByDate1() {
setWeatherPerDay(dia1);
clearStyle();
clearStyle();
element1.classList.add("is-active");
}
function printDataByDate2() {
setWeatherPerDay(dia2);
clearStyle();
element2.classList.add("is-active");
}
function printDataByDate3() {
setWeatherPerDay(dia3);
clearStyle();
element3.classList.add("is-active");
}
function printDataByDate4() {
setWeatherPerDay(dia4);
clearStyle();
element4.classList.add("is-active");
}
return (
<div className="weather-day-container">
<h2
className="weather-day is-active"
id="element0"
onClick={printDataByDate0}
>
{day(0)}
</h2>
<h2 className="weather-day" id="element1" onClick={printDataByDate1}>
{day(1)}
</h2>
<h2 className="weather-day" id="element2" onClick={printDataByDate2}>
{day(2)}
</h2>
<h2 className="weather-day" id="element3" onClick={printDataByDate3}>
{day(3)}
</h2>
<h2 className="weather-day" id="element4" onClick={printDataByDate4}>
{day(4)}
</h2>
</div>
);
}
export default WeatherDay;
|
const runtimeOnly = {
entry: './dist/src/entrypoints/runtimeOnly.js',
output: {
filename: 'dist/stopify.bundle.js',
library: 'stopify',
libraryTarget: 'var'
},
devtool: 'source-map',
node: {
// Commander has these as dependencies
'fs': 'empty',
'child_process': 'empty',
}
};
const compilerAndRuntime = {
entry: './dist/src/entrypoints/compiler.js',
output: {
filename: 'dist/stopify-full.bundle.js',
library: 'stopify',
libraryTarget: 'var'
},
devtool: 'source-map',
node: {
// Commander has these as dependencies
'fs': 'empty',
'child_process': 'empty',
'net': 'empty',
'module': 'empty'
}
};
module.exports = [ runtimeOnly, compilerAndRuntime ];
|
// Define Elements in JS
const currencyEl_one = document.getElementById("currency-one");
const currencyEl_two = document.getElementById("currency-two");
const amount_one = document.getElementById("amount-one");
const amount_two = document.getElementById("amount-two");
const rateEl = document.getElementById("rate");
const swap = document.getElementById("swap");
// Event Listeners
currencyEl_one.addEventListener("change", calculate);
currencyEl_two.addEventListener("change", calculate);
amount_one.addEventListener("input", calculate); // fires off on input
amount_two.addEventListener("input", calculate);
swap.addEventListener("click", swapCurrency);
// Fetch xrates and update the DOM
function calculate() {
const currency_one = currencyEl_one.value;
const currency_two = currencyEl_two.value;
fetch(`https://api.exchangeratesapi.io/latest/`)
.then((res) => res.json()) // convert res obj to a json obj
// data is now the json obj
.then((data) => {
let rate1 = 1.0;
let rate2 = 1.0;
console.log(data);
if (currency_one !== "EUR") {
rate1 = data.rates[currency_one];
}
if (currency_two !== "EUR") {
rate2 = data.rates[currency_two];
}
console.log(rate1, rate2);
const cross_rate = (rate2 / rate1).toFixed(4); // restrict to 4dp
console.log(cross_rate);
rateEl.innerText = `${currency_one}1 = ${currency_two}${cross_rate}`;
amount_two.value = (amount_one.value * cross_rate).toFixed(2);
});
}
function swapCurrency() {
const temp = currencyEl_one.value;
currencyEl_one.value = currencyEl_two.value;
currencyEl_two.value = temp;
calculate();
}
|
var express = require('express');
var app = express();
//var lookupAudio = new Function("rfid", "if(rfid==='6A003E4B243B') {return 'It\'s a C!';} else {return 'Not found :(';}");
function lookupAudio(rfid) {
if(rfid === "6A003E4B243B") {
return "C_SOUND.AFM";
}
else if(rfid === "6A003E1E3C76") {
return "A_SOUND.AFM";
}
else if(rfid === "6A003E503C38") {
return "T_SOUND.AFM";
}
else {
return "NOT FOUND!";
}
}
app.get('/', function(req, res){
res.set('Content-Type', 'text/plain');
res.send('Welcome!');
});
app.get('/hello', function(req, res){
var query;
res.set('Content-Type', 'text/plain');
query = req.query.rfid;
//res.send('Hello, CC3000! I found ' + query + 'as a query string for rfid/n');
res.send(/*'Sent query for rfid = ' + query + ' : ' + */lookupAudio(query));
});
app.get('/json', function(req,res){
res.json({msg:'Hello CC3000 from JSON'});
});
/*
char tag11[13] = "6A003E4B243B"; //our tags C
char tag12[13] = "6A003E1E3C76"; //our tags A
char tag13[13] = "6A003E503C38"; //our tags T
*/
app.listen(8080);
console.log('Listening on port 8080');
|
var gulp = require('gulp');
var px2rem = require('gulp-px2rem');
var sass = require('gulp-sass');
sass.compiler = require('node-sass');
//rem配置项
var px2remOption = {
rootValue: 64,//根字体大小 元素尺寸 / (效果图的尺寸/10)
unitPrecision: 3,//保留小数点后几位
propertyBlackList: [],//黑名单,不需要编译的属性
propertyWhiteList: [],//白名单,需要编译的
replace: true,//是否替换原属性 默认为 false, true替换
minPx: 10 // 最小单位,小于这个单位的时候,不转换
}
//sass编译成css
function sassout() {
return gulp.src('./sass/*.scss')
.pipe(sass({ outputStyle: 'expanded' }).on('error', sass.logError))
.pipe(gulp.dest('./style'));
}
//px转rem
function pxtorem() {
return gulp.src('./style/*.css')
.pipe(px2rem(px2remOption))
.pipe(gulp.dest('./css'));
}
//当sass文件被保存时候,编译成css。再编译成rem,再触发浏览器自动刷新
function watch() {
// gulp.watch('./sass/*.scss', gulp.series(sassout, gulp.series(pxtorem)));
gulp.watch('./sass/*.scss').on("change", gulp.series(sassout, gulp.series(pxtorem)));
gulp.watch("./css/*.css");
gulp.watch("*.html");
}
gulp.task('abs', watch);
|
/**
* Provides services to execute queries on Informix database
*/
const config = require('config')
const Wrapper = require('informix-wrapper')
const logger = require('./logger')
const informixOptions = config.get('INFORMIX')
const writeOperationRegex = new RegExp('^(insert|update|delete|create)', 'i') // Regex to check if sql query is a write operation
/**
* Creates a connection to Informix
* @param {String} database Name of database to connect to
* @param {Boolean} isWrite Whether the query is a write operation or not
* @param {Function} reject The callback function called in case of errors
* @returns {Object} The connection object
*/
function createConnection (database, isWrite, reject) {
const jdbc = new Wrapper({ ...informixOptions, ...{ database } })
jdbc.on('error', (err) => {
if (isWrite) {
jdbc.endTransaction(err, (err) => {
jdbc.disconnect()
return reject(err)
})
} else {
jdbc.disconnect()
return reject(err)
}
})
return jdbc.initialize()
}
/**
* Executes a sql query on the given database
* @param {String} database Name of database to query on
* @param {String} sql The sql query
* @param {Object} [params] Optional configuration options
* @returns {Promise<Object|Error>} Returns the result of the query on success or the error object on failure
*/
function executeQuery (database, sql, params) {
return new Promise((resolve, reject) => {
const isWrite = writeOperationRegex.test(sql.trim())
const connection = createConnection(database, isWrite, reject)
connection.connect((err) => {
if (err) {
connection.disconnect()
return reject(err)
}
if (isWrite) { // Write operations are executed inside a transaction
connection.beginTransaction(() => {
connection.query(sql, (err, res) => {
if (err) {
return reject(err)
}
resolve(res)
}, {
start: (q) => {
logger.debug(`Starting to execute ${q}`)
},
finish: (f) => {
connection.endTransaction(null, () => {
connection.disconnect()
logger.debug(`Finished executing`)
})
}
}).execute(params)
})
} else {
connection.query(sql, (err, res) => {
if (err) {
return reject(err)
}
resolve(res)
}, {
start: (q) => {
logger.debug(`Starting to execute ${q}`)
},
finish: (f) => {
connection.disconnect()
logger.debug(`Finished executing`)
}
}).execute(params)
}
})
})
}
module.exports = {
executeQuery
}
|
import React, { Component } from 'react';
import {Container, Row, } from 'react-bootstrap';
class About extends Component {
render() {
return (
<div>
<Container>
<Row>
<div
style={{
opacity: ".7",
width: "50%",
margin: "auto",
}}
>
<h2
style={{
marginTop: "200px",
width: "100%",
border: "1px solid black",
padding: "10px",
boxShadow: "-1px 1px 10px 5px rgba(0,0,0,0.75)",
borderRadius: "25px",
fontSize: "20px",
fontWeight: "bold",
}}
>
{" "}
My name is Tyler, and I am a recent full stack developer. I
enjoy good food, a game or two in my spare time, and Anime
conventions/cosplaying going hand in hand. My love for
technology can only be trumped by my love for all things cute!
Im a rather shy guy, but can be loads of fun once I warm up to
you. I love listening to people, and have a great willingness to
learn. If you need anyone to lean on, or just need a friend in
general Ill be there for you as well!
</h2>
</div>
</Row>
</Container>
</div>
);
}
}
export default About;
|
//1.3.1
// function greet(greeting, name = 'John') {
// console.log(greeting + ', ' + name);
// }
//
// greet("Hello");
//1.3.2
// function receive(complete) {
// complete();
// }
//
// receive();
// function receive(complete) {
// complete();
// }
//
// receive(function() {
// console.log('complete');
// })
// function receive(complete = function() {console.log('complete')}) {
// complete();
// }
//
// receive();
function receive(complete = () => console.log('complete')) {
complete();
}
receive();
|
import React, { useState } from 'react';
import styled from 'styled-components';
//import DetailPage from '../Detail/DetailPage';
//import Avartar from '../Detail/DetailFunction/Avartar';
//import LikeInterest from '../Detail/DetailFunction/Like_Interest';
const LeftBottomContainer = styled.div`
position: absolute;
left: 6px;
bottom: 5px;
display: flex;
flex-direction: column;
align-items: center;
visibility: hidden;
`;
const RightBottomContainer = styled.div`
position: absolute;
bottom: 5px;
right: 6px;
display: flex;
align-items: center;
visibility: hidden;
`;
const RightTopContainer = styled.div`
position: absolute;
top: 4px;
right: 6px;
display: flex;
align-items: center;
`;
const Image = styled.img`
width: 224px;
height: 160px;
border-radius: 10px;
object-fit: container;
transition: transform 450ms;
:hover {
transform: scale(1.1);
}
`;
const ImageContainer = styled.div`
position: relative;
margin-right: 24px;
cursor: pointer;
:hover {
${LeftBottomContainer} {
visibility: visible;
}
${RightBottomContainer} {
visibility: visible;
}
${Image} {
opacity: 0.9;
transition: opacity 450ms ease-out;
}
}
`;
const TextBox = styled.label`
font-size: 10px;
font-weight: 500;
line-height: 14px;
letter-spacing: -0.2px;
`;
function BestPicture({
id,
member,
btitle,
bcontent,
image,
location
}) {
const [isModalOpen, setIsModalOpen] = useState(false);
const onClose = () => {
setIsModalOpen(false);
};
return (
<>
{/* <DetailPage
id={id}
open={isModalOpen}
close={onClose}
advertising={advertising}
area={area}
avatar={avatar}
heart={heart}
imageUrl={imageUrl}
latitude={latitude}
longitude={longitude}
mood={mood}
novelty={novelty}
rating={rating}
review={review}
timestamp={timestamp}
title={title}
username={username}
address={address}
uid={uid}
/> */}
<ImageContainer onClick={() => setIsModalOpen(true)}>
<Image src={image} alt="" /> {/*<Image src={imageUrl} alt="" /> */}
<LeftBottomContainer>
{/* <Avartar uid={uid} Type="Best" /> */}
<TextBox>{id}</TextBox>
</LeftBottomContainer>
<RightTopContainer>
{btitle}
<image src="./images/pinger.png" alt="?" />
{/* <LikeInterest postId={id} Type="small" /> */}
</RightTopContainer>
<RightBottomContainer>
<img
style={{ marginRight: '4px' }}
src="./images/location.png"
alt=""
/>
<TextBox>{location}</TextBox> {/* <TextBox>{area}</TextBox> */}
</RightBottomContainer>
</ImageContainer>
</>
);
}
export default BestPicture;
|
import React from 'react';
import classes from './List.css';
const button = (props) => (
<div className = {classes.Center}>
<li>
{props.children}
</li>
</div>
)
export default button;
|
const {merge} = require('webpack-merge')
const common = require('./webpack.common.js')
const TerserPlugin = require('terser-webpack-plugin')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
module.exports = () => {
const entry = './src/index.ts'
return merge(
common(entry),
{
mode: 'production',
optimization: {
emitOnErrors: true,
minimizer: [
new TerserPlugin({
parallel: true
}),
new CssMinimizerPlugin()
]
},
plugins: [
new CopyPlugin({
patterns: [
{from: '*.md', to: './'},
{from: '*.{png,jpg,jpeg,gif}', to: './', noErrorOnMissing: true},
{from: 'manifest.json', to: './', noErrorOnMissing: true},
{from: 'schema.json', to: './', noErrorOnMissing: true}
]
})
]
}
)
}
|
function fn1 (){
this.foo = function (){
console.log(11111);
}
}
const fn1 = new fn1()
function fn2 (){
}
fn2.prototype.foo = function (){
console.log(11111);
}
const fn2 = new fn2()
|
function getCookie(name) {
var r = document.cookie.match('\\b' + name + '=([^;]*)\\b');
return r ? r[1] : undefined;
}
function isMail(mail) {
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;
if (filter.test(mail)) return true;
else return false;
}
function isDomain(domain) {
var filter = /^([a-zA-Z0-9_])+$/;
if (filter.test(domain)) return true;
else return false;
}
|
var gBuses = (function () {
var sesion = false;
var lBuses;
var DatosBasicos;
var OpcionEjecutar;
var indexBusSeleccionado;
var table;
var guardar = false;
// id de los documentos
var docSOAT = 1;
var docTecMec = 2;
var docTarOpe = 3;
var docPolCont = 4;
var docPolExtCont = 5;
var _addHandlers = function () {
$("#btnDetallesBus").click(function () {
$('#ModalDetallesBus').modal('show');
gBuses.LimpiarDeshabilitar();
VerDetallesBusSeleccionado();
});
$("#btnCerrarSesion").click(function () {
varLocal.removeUser();
varLocal.removeRol();
window.location.href = "index.html";
});
$("#btnNuevoBus").click(function () {
OpcionEjecutar = "Nuevo";
$('#ModalDetallesBus').modal('show');
gBuses.LimpiarHabilitar();
});
$("#btnEditarBus").click(function () {
OpcionEjecutar = "Editar";
$('#ModalDetallesBus').modal('show');
gBuses.LimpiarHabilitar();
$("#txtPlacabus").byaSetHabilitar(false);
VerDetallesBusSeleccionado();
});
$("#btnGuardarBus").click(function () {
if (OpcionEjecutar == "Nuevo") RegistrarNuevoBus();
if (OpcionEjecutar == "Editar") EditarBus();
});
$("#btnGuardarDoc").click(function () {
guardarDocumentos();
$('#wait').toggle();
CargarBuses();
});
$("#btnEliminarBus").click(function () {
var confirmacion = confirm("Esta seguro que quiere eliminar el bus de placa " + lBuses[indexBusSeleccionado].Placa + "?\nUna vez borrado no podra recuperar ninguna informacion de ese bus");
if(confirmacion) EliminarBus();
});
$("#btnDocumentos").click(function () {
guardar = false;
VerDocumentos();
$('#ModalDocumentos').modal('show');
});
$("#btnNuevoGrupo").click(function () {
$("#txtNombreGrupo").val("");
$("#modalNuevoGrupo").modal("show");
});
$("#btnGuardarNuevoGrupo").click(function () {
var NomGrup = $("#txtNombreGrupo").val();
if (NomGrup != "") {
NuevoGrupo(NomGrup);
} else alert("Debe especificar un nombre para el grupo...");
});
$("#btnImprimir").click(function () {
imprimirBuses();
});
$('#tBuses tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
}
else {
table.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
}
});
$(".gDocumentos").keypress(function () {
guardar = true;
});
$('#ModalDocumentos').on('hidden.bs.modal', function () {
// do something…
//$('#wait').toggle();
//CargarBuses();
})
};
var _createElements = function () {
CargarDatosBasicos();
createTable();
};
var _VerificarPermisos = function () {
var user = varLocal.getUser();
var rol = varLocal.getRol();
if ((user != null) && (rol != null) && (rol == 3)) {
$("#dvdUser").html('<i class="fa fa-user"></i> ' + user + ' <b class="caret">');
listaPermisos = Permisos.Get(rol);
$.each(listaPermisos, function (index, item) {
$("#" + item).fadeIn();
});
return true;
}
else return false;
};
var CargarBuses = function () {
BusesDAO.Gets(function (result) {
//$('#wait').toggle();
table.destroy();
lBuses = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;
$("#tableBuses").html("");
$.each(lBuses, function (index, item) {
var Fecha = byaPage.converJSONDate(item.FechaMatricula);
$("#tableBuses").append("<tr id='" + index + "' onclick='gBuses.SeleccionarBusTabla(id)'><td>" + item.Placa +
"</td><td>" + item.Vial + "</td><td>" + item.Marca + "</td><td>" + Fecha + "</td><td>" + item.NombreClaseServicio +
"</td><td>" + item.NombreClaseBus + "</td><td>" + item.NombreGrupo +
"</td><td>" + _formatJSONDate(item.FechaVencimientoSOAT) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoTecMec) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoTarOpe) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoPolCont) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoPolExtCont) + "</td></tr>");
});
createTable();
$('#wait').toggle();
});
};
var CargarDatosBasicos = function () {
DatosBasicosDAO.Get(function (result) {
DatosBasicos = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;
$("#cboClaseBus").byaCombo({
DataSource: DatosBasicos.lClasesBuses, placeHolder: 'Seleccione...', Display: "Nombre", Value: "id"
});
$("#cboClaseServicio").byaCombo({
DataSource: DatosBasicos.lClasesServicio, placeHolder: 'Seleccione...', Display: "Nombre", Value: "id"
});
$("#cboGrupoBus").byaCombo({
DataSource: DatosBasicos.lGruposBuses, placeHolder: 'Seleccione...', Display: "Nombre", Value: "id"
});
});
};
var _esValidoDatosBus = function () {
var ban = true;
var cadenaError = "Error:";
if ($("#txtPlacabus").val() == "") {
ban = false;
cadenaError = cadenaError + "\nLa placa no puede ir vacia...";
}
if ($("#txtVial").val() == "") {
ban = false;
cadenaError = cadenaError + "\nEl vial no puede ir vacio...";
}
if ($("#cboClaseBus").val() == "") {
ban = false;
cadenaError = cadenaError + "\nLa clase de bus no puede ir vacio...";
}
if ($("#cboClaseServicio").val() == "") {
ban = false;
cadenaError = cadenaError + "\nLa clase de servicio no puede ir vacio...";
}
if ($("#fchMatricula").val() == "") {
ban = false;
cadenaError = cadenaError + "\nLa fecha de matricula no puede ir vacio...";
}
if (ban == false) alert(cadenaError);
return ban;
};
var _getDatosBus = function () {
var e = {}
e.Placa = $("#txtPlacabus").val();
e.Vial = $("#txtVial").val();
e.Capacidad = $("#txtCapacidad").val();
e.ClaseBus = $("#cboClaseBus").val();
e.ClaseServicio = $("#cboClaseServicio").val();
e.Marca = $("#txtMarca").val();
e.Modelo = $("#txtModelo").val();
e.NumeroChasis = $("#txtNumeroChasis").val();
e.NumeroMotor = $("#txtNumeroMotor").val();
e.Observaciones = $("#txtObservaciones").val();
e.Password = $("#txtPassword").val();
e.Grupo = $("#cboGrupoBus").val();
var fecha = "" + $("#fchMatricula").val(); + "";
fecha = fecha.split("-");
e.DiaMatricula = fecha[2];
e.MesMatricula = fecha[1];
e.AñoMatricula = fecha[0];
return e;
};
var RegistrarNuevoBus = function () {
if (_esValidoDatosBus()) {
BusesDAO.Insert(_getDatosBus(), function (result) {
var respuesta = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;
if (respuesta.Error == false) {
CargarBuses();
$("#ModalDetallesBus").modal("hide");
} else {
alert(respuesta.Mensaje);
}
});
}
};
var _dibujarTablaBusesSeleccionado = function (indexactual) {
table.destroy();
$("#tableBuses").html("");
$.each(lBuses, function (index, item) {
var Fecha = byaPage.converJSONDate(item.FechaMatricula);
if (indexactual == index) $("#tableBuses").append("<tr class='info' id='" + index +
"' onclick='gBuses.SeleccionarBusTabla(id)'><td>" + item.Placa + "</td><td>" + item.Vial +
"</td><td>" + item.Marca + "</td><td>" + Fecha + "</td><td>" + item.NombreClaseServicio +
"</td><td>" + item.NombreClaseBus + "</td><td>" + item.NombreGrupo +
"</td><td>" + _formatJSONDate(item.FechaVencimientoSOAT) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoTecMec) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoTarOpe) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoPolCont) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoPolExtCont) + "</td></tr>");
else $("#tableBuses").append("<tr id='" + index + "' onclick='gBuses.SeleccionarBusTabla(id)'><td>" + item.Placa +
"</td><td>" + item.Vial + "</td><td>" + item.Marca + "</td><td>" + Fecha + "</td><td>" + item.NombreClaseServicio +
"</td><td>" + item.NombreClaseBus + "</td><td>" + item.NombreGrupo +
"</td><td>" + _formatJSONDate(item.FechaVencimientoSOAT) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoTecMec) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoTarOpe) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoPolCont) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoPolExtCont) + "</td></tr>");
});
createTable();
};
var _formatJSONDate = function (jsonDate) {
//var da = new Date(parseInt(jsonDate.substr(6)));
//return da.toLocaleDateString();
return byaPage.converJSONDate(jsonDate)
};
var VerDetallesBusSeleccionado = function () {
$("#txtPlacabus").val(lBuses[indexBusSeleccionado].Placa);
$("#txtVial").val(lBuses[indexBusSeleccionado].Vial);
$("#txtCapacidad").val(lBuses[indexBusSeleccionado].Capacidad);
$("#cboGrupoBus").val(lBuses[indexBusSeleccionado].Grupo);
$("#cboClaseBus").val(lBuses[indexBusSeleccionado].ClaseBus);
$("#cboClaseServicio").val(lBuses[indexBusSeleccionado].ClaseServicio);
$("#txtMarca").val(lBuses[indexBusSeleccionado].Marca);
$("#txtModelo").val(lBuses[indexBusSeleccionado].Modelo);
$("#txtNumeroChasis").val(lBuses[indexBusSeleccionado].NumeroChasis);
$("#txtNumeroMotor").val(lBuses[indexBusSeleccionado].NumeroMotor);
$("#txtObservaciones").val(lBuses[indexBusSeleccionado].Observaciones);
$("#txtPassword").val(lBuses[indexBusSeleccionado].Password);
$("#fchMatricula").val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaMatricula));
};
var VerDocumentos = function () {
$("#modalTPlaca").empty().append("Placa: " + lBuses[indexBusSeleccionado].Placa);
$("#modalTVial").empty().append("Vial: " + lBuses[indexBusSeleccionado].Vial);
// SOAT
$("#txtNumeroSOAT").empty().val(lBuses[indexBusSeleccionado].NumeroSOAT);
$("#txtFchExpSOAT").empty().val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaExpedicionSOAT));
$("#txtFchVenSOAT").empty().val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaVencimientoSOAT));
//Tecnico Mecanica
$("#txtNumeroTecMec").empty().val(lBuses[indexBusSeleccionado].NumeroTecMec);
$("#txtFchExpTecMec").empty().val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaExpedicionTecMec));
$("#txtFchVenTecMec").empty().val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaVencimientoTecMec));
// Tarjeta de operacion
$("#txtNumeroTarOp").empty().val(lBuses[indexBusSeleccionado].NumeroTarOpe);
$("#txtFchExpTarOp").empty().val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaExpedicionTarOpe));
$("#txtFchVenTarOp").empty().val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaVencimientoTarOpe));
// Poliza contractual
$("#txtNumeroPolCon").empty().val(lBuses[indexBusSeleccionado].NumeroPolCont);
$("#txtFchExpPolCon").empty().val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaExpedicionPolCont));
$("#txtFchVenPolCon").empty().val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaVencimientoPolCont));
// Poliza extracontractual
$("#txtNumeroPoExCon").empty().val(lBuses[indexBusSeleccionado].NumeroPolExtCont);
$("#txtFchExpPoExCon").empty().val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaExpedicionPolExtCont));
$("#txtFchVenPoExCon").empty().val(byaPage.converJSONDate(lBuses[indexBusSeleccionado].FechaVencimientoPolExtCont));
};
var EliminarBus = function () {
BusesDAO.Delete(lBuses[indexBusSeleccionado].Placa, function (result) {
var respuesta = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;
if (respuesta.Error == false) {
CargarBuses();
} else {
alert(respuesta.Mensaje);
}
});
};
var EditarBus = function () {
if (_esValidoDatosBus()) {
BusesDAO.Update(_getDatosBus(), function (result) {
var respuesta = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;
if (respuesta.Error == false) {
CargarBuses();
$("#ModalDetallesBus").modal("hide");
} else {
alert(respuesta.Mensaje);
}
});
}
};
var NuevoGrupo = function (NomGru) {
BusesDAO.InsertGrupo(NomGru, function (result) {
var respuesta = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;
if (respuesta.Error == false) {
CargarDatosBasicos();
$("#modalNuevoGrupo").modal("hide");
}
alert(respuesta.Mensaje);
});
};
var guardarDocumentos = function () {
//alert("Entro");
if (guardar) {
var plac = lBuses[indexBusSeleccionado].Placa;
lDocBus = [{ documento: docSOAT, placa: plac, Numero: $("#txtNumeroSOAT").val(), fechaExpedicion: new Date($("#txtFchExpSOAT").val()), fechaExpiracion: new Date($("#txtFchVenSOAT").val()) },
{ documento: docTecMec, placa: plac, Numero: $("#txtNumeroTecMec").val(), fechaExpedicion: new Date($("#txtFchExpTecMec").val()), fechaExpiracion: new Date($("#txtFchVenTecMec").val()) },
{ documento: docTarOpe, placa: plac, Numero: $("#txtNumeroTarOp").val(), fechaExpedicion: new Date($("#txtFchExpTarOp").val()), fechaExpiracion: new Date($("#txtFchVenTarOp").val()) },
{ documento: docPolCont, placa: plac, Numero: $("#txtNumeroPolCon").val(), fechaExpedicion: new Date($("#txtFchExpPolCon").val()), fechaExpiracion: new Date($("#txtFchVenPolCon").val()) },
{ documento: docPolExtCont, placa: plac, Numero: $("#txtNumeroPoExCon").val(), fechaExpedicion: new Date($("#txtFchExpPoExCon").val()), fechaExpiracion: new Date($("#txtFchVenPoExCon").val()) }];
//alert(JSON.stringify(lDocBus));
//alert((new Date($("#txtFchExpSOAT").val())).toDateString());
BusesDAO.InsertOrUpdateDocumentos(lDocBus, function (result) {
//alert(JSON.stringify(result));
});
}
};
var imprimirBuses = function () {
if (lBuses != null) {
$.get("/PlantillasImpresion/PrintListaBuses.html", function (data) {
var Empresa, tbody = "";
EmpresaDAO.Get(function (result) {
Empresa = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;
//alert(JSON.stringify(Empresa));
data = data.replace("{NOM_EMPRESA}", '<h2><strong> ' + Empresa.RAZON_SOCIAL + ' </strong></h2>');
data = data.replace("{NIT_EMPRESA}", Empresa.NIT + '-' + Empresa.DIG_VER);
//alert(data);
$.each(lBuses, function (index, item) {
var Fecha = byaPage.converJSONDate(item.FechaMatricula);
tbody = tbody + "<tr><td>" + item.Placa +
"</td><td>" + item.Vial + "</td><td>" + item.Marca + "</td><td>" + Fecha + "</td><td>" + item.NombreClaseServicio +
"</td><td>" + item.NombreClaseBus + "</td><td>" + item.NombreGrupo +
"</td><td>" + _formatJSONDate(item.FechaVencimientoSOAT) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoTecMec) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoTarOpe) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoPolCont) +
"</td><td>" + _formatJSONDate(item.FechaVencimientoPolExtCont) + "</td></tr>";
});
//alert(data);
data = data.replace("{BUSES}", tbody);
// Esta es la parte que te abre la ventana de imprecion...
var win;
win = window.open();
win.document.write(data);
win.print();
win.close();
});
});
}
};
var createTable = function () {
$(function () { // Crear DataTable
table = $('#tBuses').DataTable({
"language": {
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible en esta tabla",
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate": {
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria": {
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
}
},
scrollY: "280px",
scrollX: true,
scrollCollapse: true,
paging: true,
"order": [[7, "asc"]]
});
new $.fn.dataTable.FixedColumns(table);
});
};
return {
init: function () {
if (_VerificarPermisos()) {
_createElements();
_addHandlers();
//$('#wait').toggle();
CargarBuses();
} else window.location.href = "index.html";
},
LimpiarHabilitar: function () {
$("#txtPlacabus").byaSetHabilitar(true);
$("#txtVial").byaSetHabilitar(true);
$("#txtCapacidad").byaSetHabilitar(true);
$("#cboClaseBus").byaSetHabilitar(true);
$("#cboClaseServicio").byaSetHabilitar(true);
$("#fchMatricula").byaSetHabilitar(true);
$("#txtMarca").byaSetHabilitar(true);
$("#txtModelo").byaSetHabilitar(true);
$("#txtNumeroChasis").byaSetHabilitar(true);
$("#txtNumeroMotor").byaSetHabilitar(true);
$("#txtObservaciones").byaSetHabilitar(true);
$("#txtPassword").byaSetHabilitar(true);
$("#cboGrupoBus").byaSetHabilitar(true);
$("#cboGrupoBus").val("");
$("#txtPlacabus").val("");
$("#txtVial").val("");
$("#txtCapacidad").val("");
$("#cboClaseBus").val("");
$("#cboClaseServicio").val("");
$("#fchMatricula").val("");
$("#txtMarca").val("");
$("#txtModelo").val("");
$("#txtNumeroChasis").val("");
$("#txtNumeroMotor").val("");
$("#txtObservaciones").val("");
$("#txtPassword").val("");
},
LimpiarDeshabilitar: function () {
$("#txtPlacabus").byaSetHabilitar(false);
$("#txtVial").byaSetHabilitar(false);
$("#txtCapacidad").byaSetHabilitar(false);
$("#cboClaseBus").byaSetHabilitar(false);
$("#cboClaseServicio").byaSetHabilitar(false);
$("#txtMarca").byaSetHabilitar(false);
$("#fchMatricula").byaSetHabilitar(false);
$("#txtModelo").byaSetHabilitar(false);
$("#txtNumeroChasis").byaSetHabilitar(false);
$("#txtNumeroMotor").byaSetHabilitar(false);
$("#txtObservaciones").byaSetHabilitar(false);
$("#txtPassword").byaSetHabilitar(false);
$("#cboGrupoBus").byaSetHabilitar(false);
$("#cboGrupoBus").val("");
$("#txtPlacabus").val("");
$("#txtVial").val("");
$("#txtCapacidad").val("");
$("#cboClaseBus").val("");
$("#cboClaseServicio").val("");
$("#fchMatricula").val("");
$("#txtMarca").val("");
$("#txtModelo").val("");
$("#txtNumeroChasis").val("");
$("#txtNumeroMotor").val("");
$("#txtObservaciones").val("");
$("#txtPassword").val("");
},
SeleccionarBusTabla: function (index) {
indexBusSeleccionado = index;
//_dibujarTablaBusesSeleccionado(index);
}
};
}());
$(document).ready(function () {
gBuses.init();
});
|
const express = require('express');
const router = express.Router();
const UserController = require('../controllers/UserController');
const ProductController = require('../controllers/ProductController');
const CategoryController = require('../controllers/CategoryController');
// Router: Users
router.get('/user', UserController.findAll);
// Router: Products
router.get('/product', ProductController.findAll);
// Router: Categories
router.get('/category', CategoryController.findAll);
module.exports = router;
|
require("../common/vendor.js"), (global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/chat_list/chat/_msg_sys_tip" ], {
"701b": function(t, n, e) {
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = void 0;
var a = {
props: {
msg: {
type: String
}
}
};
n.default = a;
},
8044: function(t, n, e) {
e.r(n);
var a = e("701b"), c = e.n(a);
for (var o in a) [ "default" ].indexOf(o) < 0 && function(t) {
e.d(n, t, function() {
return a[t];
});
}(o);
n.default = c.a;
},
"8b6e": function(t, n, e) {},
"93ea": function(t, n, e) {
e.r(n);
var a = e("da98"), c = e("8044");
for (var o in c) [ "default" ].indexOf(o) < 0 && function(t) {
e.d(n, t, function() {
return c[t];
});
}(o);
e("998b");
var r = e("f0c5"), s = Object(r.a)(c.default, a.b, a.c, !1, null, "79dfa19f", null, !1, a.a, void 0);
n.default = s.exports;
},
"998b": function(t, n, e) {
var a = e("8b6e");
e.n(a).a;
},
da98: function(t, n, e) {
e.d(n, "b", function() {
return a;
}), e.d(n, "c", function() {
return c;
}), e.d(n, "a", function() {});
var a = function() {
var t = this;
t.$createElement;
t._self._c;
}, c = [];
}
} ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "pages/chat_list/chat/_msg_sys_tip-create-component", {
"pages/chat_list/chat/_msg_sys_tip-create-component": function(t, n, e) {
e("543d").createComponent(e("93ea"));
}
}, [ [ "pages/chat_list/chat/_msg_sys_tip-create-component" ] ] ]);
|
const express = require("express")
const cors = require("cors");
const PORT = 12345;
let app = express();
app.use(function (req, res, next) {
console.log('Time:', Date.now())
next()
})
app.use(cors( //sets the origin able to access sites to be localhsot.
{
origin: 'http://localhost'
}
))
app.use('/method', function (req, res, next) {
console.log('Request Type:', req.method)
next()
})
app.get("/param/:arg", function (req, res) {
res.status(200).send(`you send in${req.params.arg}`)
})
app.listen(PORT, "localhost", function () {
console.log(`listening on ${PORT}`)
})
|
import React, { Component } from 'react';
import styles from './index.module.scss';
import ctx from '@/assets/js/ctx';
import { connect } from "react-redux";
import Header from '@/components/Header';
import {changeToken} from '@/store/actionCreators'
export class MyCenterUI extends Component {
static contextType = ctx;
constructor() {
super()
this.state = {
userName: ""
}
}
reqUserInfo = () => {
this.context.axios.post('/users/info', {
token: this.props.token
}).then((res) => {
const {code, msg, userName} = res;
if(code == 1){
this.setState({
userName: userName
})
}else{
alert(msg)
}
})
}
// 退出登录
quitLogin = () => {
localStorage.setItem('token', "");
this.props.changeToken("");
this.props.history.push('/home');
}
componentDidMount() {
this.reqUserInfo()
}
render() {
const {userName} = this.state;
return (
<div className={styles.mycenter}>
<Header title="个人中心" />
<div className={styles.center_header}>
<div className={styles.center_img}>
<img className={styles.myimg} src={require('@/assets/images/center.jpg')} alt=""/>
</div>
<p className={styles.user_name}>{userName}</p>
</div>
<ul className={styles.btn_group}>
<li className={styles.btn_li}>
<span>0</span>
<p className={styles.num}>月票</p>
</li>
<li className={styles.btn_li}>
<span>0</span>
<p className={styles.num}>推荐票</p>
</li>
<li className={styles.btn_li}>
<span>0</span>
<p className={styles.num}>限免券</p>
</li>
</ul>
<ul className={styles.nav}>
<li className={styles.nav_li}>
<div>
<em className="iconfont icon-huiyuan"></em>
<span>会员中心</span>
</div>
<span className={styles.right}>></span>
</li>
<li className={styles.nav_li}>
<div>
<em className="iconfont icon-xiaoxi1"></em>
<span>消息中心</span>
</div>
<span className={styles.right}>></span>
</li>
<li className={styles.nav_li}>
<div>
<em className="iconfont icon-anquan"></em>
<span>安全中心</span>
</div>
<span className={styles.right}>></span>
</li>
<li className={styles.nav_li}>
<div>
<em className="iconfont icon-bangzhu"></em>
<span>帮助中心</span>
</div>
<span className={styles.right}>></span>
</li>
<li className={styles.nav_li}>
<div>
<em className="iconfont icon-xiaoxi"></em>
<span>会员中心</span>
</div>
<span className={styles.right}>></span>
</li>
</ul>
<div className={styles.quit_btn} onClick={this.quitLogin}>退出登录</div>
</div>
)
}
}
function mapStateToProps(state){
return {
token: state.getToken.token
}
}
function mapDispatchToProps(dispatch){
return {
changeToken: (item) => {
return dispatch(changeToken(item))
}
}
}
const MyCenterContainer = connect(mapStateToProps, mapDispatchToProps)(MyCenterUI)
export default MyCenterContainer
|
//Part of Meishuu's 'slash' script to decode HTML
const entities = {
amp: '&',
lt: '<',
gt: '>',
quot: '"',
apos: "'",
}
module.exports = {
decodeHTMLEntities(s) {
return (s
.replace(/<\/?[^<>]*>/gi, '')
.replace(/&#(\d+);?/g, (_, code) => String.fromCharCode(code))
.replace(/&#[xX]([A-Fa-f0-9]+);?/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)))
.replace(/&([^;\W]+;?)/g, (m, e) => entities[e.replace(/;$/, '')] || m)
)
}
}
|
import Template from "./template";
import paper from "paper";
import ComponentPort from "../core/componentPort";
export default class LLChamber extends Template {
constructor() {
super();
}
__setupDefinitions() {
this.__unique = {
position: "Point"
};
this.__heritable = {
componentSpacing: "Float",
width: "Float",
length: "Float",
height: "Float",
rotation: "Float",
spacing: "Float",
numberOfChambers: "Integer"
};
this.__defaults = {
componentSpacing: 1000,
width: 400,
length: 5000,
height: 250,
spacing: 2000,
numberOfChambers: 4,
rotation: 0
};
this.__units = {
componentSpacing: "μm",
width: "μm",
length: "μm",
height: "μm",
spacing: "μm",
numberOfChambers: "10",
rotation: "°"
};
this.__minimum = {
componentSpacing: 0,
width: 5,
length: 5,
height: 1,
spacing: 1,
numberOfChambers: 1,
rotation: 0
};
this.__maximum = {
componentSpacing: 10000,
width: 50000,
length: 50000,
height: 50000,
numberOfChambers: 1000,
spacing: 50000,
rotation: 360
};
this.__featureParams = {
componentSpacing: "componentSpacing",
position: "position",
width: "width",
length: "length",
height: "height",
numberOfChambers: "numberOfChambers",
spacing: "spacing",
rotation: "rotation"
};
this.__targetParams = {
componentSpacing: "componentSpacing",
position: "position",
width: "width",
length: "length",
height: "height",
numberOfChambers: "numberOfChambers",
spacing: "spacing",
rotation: "rotation"
};
this.__placementTool = "multilayerPositionTool";
this.__toolParams = {
position: "position"
};
this.__mint = "LL CHAMBER";
}
getPorts(params) {
let position = params["position"];
let px = position[0];
let py = position[1];
let l = params["length"];
let w = params["width"];
let rotation = params["rotation"];
let color = params["color"];
// let radius = params["cornerRadius"];
let numArray = params["numberOfChambers"];
let spacing = params["spacing"];
let ports = [];
ports.push(new ComponentPort(w / 2, -w, "1", "FLOW"));
ports.push(new ComponentPort(numArray * w + (numArray + 1) * spacing - w / 2, -w, "2", "FLOW"));
ports.push(new ComponentPort(w / 2, l + w, "3", "FLOW"));
ports.push(new ComponentPort(numArray * w + (numArray + 1) * spacing - w / 2, l + w, "4", "FLOW"));
// //Control Ports - Left
ports.push(new ComponentPort(0, 0.2 * l, "10", "CONTROL"));
ports.push(new ComponentPort(0, 0.5 * l, "9", "CONTROL"));
ports.push(new ComponentPort(0, 0.8 * l, "8", "CONTROL"));
//Control Ports - Right
ports.push(new ComponentPort(numArray * w + (numArray + 1) * spacing, 0.2 * l, "5", "CONTROL"));
ports.push(new ComponentPort(numArray * w + (numArray + 1) * spacing, 0.5 * l, "6", "CONTROL"));
ports.push(new ComponentPort(numArray * w + (numArray + 1) * spacing, 0.8 * l, "7", "CONTROL"));
return ports;
}
__renderFlow(params) {
let position = params["position"];
let px = position[0];
let py = position[1];
let l = params["length"];
let w = params["width"];
let rotation = params["rotation"];
let color = params["color"];
// let radius = params["cornerRadius"];
let numArray = params["numberOfChambers"];
let spacing = params["spacing"];
let rendered = new paper.CompoundPath();
let rec;
for (let i = 0; i < numArray; i++) {
rec = new paper.Path.Rectangle({
point: new paper.Point(px + (i + 1) * spacing + i * w, py - 1),
size: [w, l + 2],
radius: 0
});
rendered.addChild(rec);
}
let topchannel = new paper.Path.Rectangle({
point: new paper.Point(px, py - w),
size: [numArray * w + (numArray + 1) * spacing, w]
});
rendered.addChild(topchannel);
let bottomchannel = new paper.Path.Rectangle({
point: new paper.Point(px, py + l),
size: [numArray * w + (numArray + 1) * spacing, w]
});
rendered.addChild(bottomchannel);
rendered.fillColor = color;
return rendered.rotate(rotation, px, py);
}
__renderControl(params) {
let rendered = new paper.CompoundPath();
let position = params["position"];
let px = position[0];
let py = position[1];
let l = params["length"];
let w = params["width"];
let rotation = params["rotation"];
let color = params["color"];
// let radius = params["cornerRadius"];
let numArray = params["numberOfChambers"];
let spacing = params["spacing"];
let topchannel = new paper.Path.Rectangle({
point: new paper.Point(px, py + 0.2 * l - w / 2),
size: [numArray * w + (numArray + 1) * spacing, w]
});
rendered.addChild(topchannel);
let middlechannel = new paper.Path.Rectangle({
point: new paper.Point(px, py + 0.5 * l - w / 2),
size: [numArray * w + (numArray + 1) * spacing, w]
});
rendered.addChild(middlechannel);
let bottomchannel = new paper.Path.Rectangle({
point: new paper.Point(px, py + 0.8 * l - w / 2),
size: [numArray * w + (numArray + 1) * spacing, w]
});
rendered.addChild(bottomchannel);
rendered.fillColor = color;
return rendered.rotate(rotation, px, py);
}
render2D(params, key="FLOW") {
if (key === "FLOW") {
return this.__renderFlow(params);
} else {
return this.__renderControl(params);
}
let position = params["position"];
let px = position[0];
let py = position[1];
let l = params["length"];
let w = params["width"];
let rotation = params["rotation"];
let color = params["color"];
// let radius = params["cornerRadius"];
let numArray = params["numberOfChambers"];
let spacing = params["spacing"];
let rendered = new paper.CompoundPath();
let rec;
for (let i = 0; i < numArray; i++) {
rec = new paper.Path.Rectangle({
point: new paper.Point(px + (i + 1) * spacing + i * w, py - 1),
size: [w, l + 2],
radius: 0
});
rendered.addChild(rec);
}
let topchannel = new paper.Path.Rectangle({
point: new paper.Point(px, py - w),
size: [numArray * w + (numArray + 1) * spacing, w]
});
rendered.addChild(topchannel);
let bottomchannel = new paper.Path.Rectangle({
point: new paper.Point(px, py + l),
size: [numArray * w + (numArray + 1) * spacing, w]
});
rendered.addChild(bottomchannel);
rendered.fillColor = color;
return rendered.rotate(rotation, px, py);
}
render2DTarget(key, params) {
let ret = new paper.CompoundPath();
let flow = this.render2D(params, "FLOW");
let control = this.render2D(params, "CONTROL");
ret.addChild(control);
ret.addChild(flow);
ret.fillColor = params["color"];
ret.fillColor.alpha = 0.5;
return ret;
}
}
|
import React from 'react';
import TimePicker from '..';
import '../assets/index.less';
const App = () => <TimePicker defaultValue={new Date()} showSecond={false} minuteStep={15} />;
export default App;
|
const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
return sequelize.define('CatalogProductOptionTypePrice', {
option_type_price_id: {
autoIncrement: true,
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
primaryKey: true,
comment: "Option Type Price ID"
},
option_type_id: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
defaultValue: 0,
comment: "Option Type ID",
references: {
model: 'catalog_product_option_type_value',
key: 'option_type_id'
}
},
store_id: {
type: DataTypes.SMALLINT.UNSIGNED,
allowNull: false,
defaultValue: 0,
comment: "Store ID",
references: {
model: 'store',
key: 'store_id'
}
},
price: {
type: DataTypes.DECIMAL(20,6),
allowNull: false,
defaultValue: 0.000000,
comment: "Price"
},
price_type: {
type: DataTypes.STRING(7),
allowNull: false,
defaultValue: "fixed",
comment: "Price Type"
}
}, {
sequelize,
tableName: 'catalog_product_option_type_price',
timestamps: false,
indexes: [
{
name: "PRIMARY",
unique: true,
using: "BTREE",
fields: [
{ name: "option_type_price_id" },
]
},
{
name: "CATALOG_PRODUCT_OPTION_TYPE_PRICE_OPTION_TYPE_ID_STORE_ID",
unique: true,
using: "BTREE",
fields: [
{ name: "option_type_id" },
{ name: "store_id" },
]
},
{
name: "CATALOG_PRODUCT_OPTION_TYPE_PRICE_STORE_ID",
using: "BTREE",
fields: [
{ name: "store_id" },
]
},
]
});
};
|
//array of heads
const heads = [
{
name: "Frank- Walter Steinmeier",
image: "./images/steinmeier.jpeg",
link: "https://en.wikipedia.org/wiki/Frank-Walter_Steinmeier"
},
{
name: "Joachim Gauck",
image: "./images/gauck.jpeg",
link: "https://en.wikipedia.org/wiki/Joachim_Gauck"
},
{
name: "Horst Seehofer",
image: "./images/seehofer.jpeg",
link: "https://en.wikipedia.org/wiki/Horst_Seehofer"
},
{
name: "Christian Wulff",
image: "./images/wulff.jpeg",
link: "https://en.wikipedia.org/wiki/Christian_Wulff"
},
{
name: "Jens Böhrnsen",
image: "./images/boehrnsen.jpeg",
link: "https://en.wikipedia.org/wiki/Jens_B%C3%B6hrnsen"
}
]
export const useHeads = () => {
return heads.slice()
}
|
define([
'apps/system4/merge/merge'], function (app) {
app.module.factory("mergeService", function ($rootScope, Restangular, stdApiUrl, stdApiVersion) {
var restSrv = Restangular.withConfig(function (configSetter) {
configSetter.setBaseUrl(stdApiUrl + $rootScope.currentBusiness.Key + '/' + stdApiVersion);
})
var restAttachSrv = Restangular.withConfig(function (configSetter) {
configSetter.setBaseUrl(stdApiUrl + stdApiVersion);
})
return {
getProjects: function (filter) {
return restSrv.one("project").get(filter);
},
createProject: function (info) {
return restSrv.all("project").post(info);
},
updateProject: function (id,info) {
return restSrv.one("project", id).customPUT(info);
},
deleteProject: function (ids) {
return restSrv.one("project", ids).remove();
},
getMyTask: function () {
return restSrv.all("project").customGET("mytask");
},
taskFinish: function (id,attachID) {
return restSrv.one("task", id).customPUT({}, 'finish/' + attachID);
},
merge: function (id,optinos) {
return restSrv.one("task", id).customPUT(optinos, 'merge');
},
getMergeHistory: function (id) {
return restAttachSrv.all("attach").getList({ objkey: 'MergeProjectDocResult', objid: id });
},
}
});
});
|
/*
* @copyright Adam Benda, 2016
*/
/**
* @class
* @classdesc Static box that can be connected with Ball via rope
*/
/**
*
* @param {Matter.Engine} engine
* @param {number} x - x coordinate
* @param {number} y - y coordinate
* @returns {Ball}
*/
var Pylon = function (engine, x, y, cnt) {
this.type = "Pylon";
this.engine = engine;
this.body = Matter.Bodies.rectangle(engine.render.options.width * x, engine.render.options.height * y, 10, 10);
Matter.Body.setStatic(this.body, true);
this.body.pObject = this;
this.body.collisionFilter.mask = 2;
this.gIndicator = Matter.Bodies.circle(engine.render.options.width * x, engine.render.options.height * (y + 0.05), 3);
this.gIndicator.collisionFilter.mask = 2;
Matter.Body.setMass(this.gIndicator, 10000);
this.gIndicator.frictionAir = 0.1;
this.gIndicatorRope = Matter.Constraint.create({bodyA: this.body, bodyB: this.gIndicator, stiffness: 4});
if ((Pylon.cnt++) % 2 === 0) {
this.body.render.fillStyle = "#002d56";
this.body.render.strokeStyle = "#002d56";
} else {
this.body.render.fillStyle = "#d59f0f";
this.body.render.strokeStyle = "#d59f0f";
}
};
Pylon.cnt = 0;
|
import React, { Component } from 'react';
import Modal from 'react-modal';
import RequestService from '../../Services/RequestService';
import ToolbarContainer from '../dashboard/toolbar/ToolbarContainer';
import FindingsPart from './FindingsPart';
import { NotificationManager, NotificationContainer } from 'react-notifications';
//TODO: Implement notes added to tasks!
class Overview extends Component {
constructor(props) {
super(props);
let completedSum = 0;
for (let taskUUID in this.props.projectMeta.tasks) {
if (this.props.projectMeta.tasks[taskUUID].completed) {
completedSum++;
}
}
let proPre = 0;
if (this.props.projectMeta.tasks && Object.keys(this.props.projectMeta.tasks).length > 0) {
proPre = Math.round((completedSum / Object.keys(this.props.projectMeta.tasks).length) * 100);
}
this.openCreationModal = this.openCreationModal.bind(this);
this.afterOpenCreationModal = this.afterOpenCreationModal.bind(this);
this.closeCreationModal = this.closeCreationModal.bind(this);
this.handleChangeTaskTitle = this.handleChangeTaskTitle.bind(this);
this.handleChangeTaskDescription = this.handleChangeTaskDescription.bind(this);
this.handleChangeTaskUsers = this.handleChangeTaskUsers.bind(this);
this.createTask = this.createTask.bind(this);
this.deleteTask = this.deleteTask.bind(this);
this.updateTask = this.updateTask.bind(this);
this.completedSwitch = this.completedSwitch.bind(this);
this.calculateNewPercentage = this.calculateNewPercentage.bind(this);
this.renderModalButton = this.renderModalButton.bind(this);
this.openUpdateModal = this.openUpdateModal.bind(this);
this.openNewTaskModal = this.openNewTaskModal.bind(this);
this.convertNumberToTwo = this.convertNumberToTwo.bind(this);
this.changeFindingStats = this.changeFindingStats.bind(this);
let critical = 0;
let high = 0;
let medium = 0;
let low = 0;
for (let key in this.props.projectMeta.findings) {
switch (this.props.projectMeta.findings[key].level) {
case 'critical':
critical++;
break;
case 'high':
high++;
break;
case 'medium':
medium++;
break;
case 'low':
low++;
break;
default:
break;
}
}
this.state = {
projectUuid: this.props.projectUuid,
projectMeta: this.props.projectMeta,
projectInfo: this.props.projectInfo,
projectUsers: this.props.projectUsers,
uuid: this.props.projectMeta.projectUuid,
creationModalIsOpen: false,
progressStyle: {
width: proPre + '%'
},
progressPercentage: proPre,
createTask: {
title: '',
description: '',
users: []
},
creating: true,
updateUuid: '',
findingsStats: {
critical: critical,
high: high,
medium: medium,
low: low
}
}
}
componentDidMount() {
this.props.getProjectMeta();
}
componentWillReceiveProps(nextProp) {
this.setState({
projectUuid: nextProp.projectUuid,
projectMeta: nextProp.projectMeta,
projectInfo: nextProp.projectInfo,
projectUsers: nextProp.projectUsers,
uuid: nextProp.projectMeta.projectUuid,
}, function () {
this.calculateNewPercentage();
});
let critical = 0;
let high = 0;
let medium = 0;
let low = 0;
for (let key in this.props.projectMeta.findings) {
switch (this.props.projectMeta.findings[key].level) {
case 'critical':
critical++;
break;
case 'high':
high++;
break;
case 'medium':
medium++;
break;
case 'low':
low++;
break;
default:
break;
}
}
this.setState({
findingsStats: {
critical: critical,
high: high,
medium: medium,
low: low
}
});
}
convertNumberToTwo(number) {
return ("0" + number).slice(-2);
}
changeFindingStats(changeCrit, changeHigh, changeMedium, changeLow) {
this.setState({
findingsStats: {
critical: (this.state.findingsStats.critical + changeCrit),
high: (this.state.findingsStats.high + changeHigh),
medium: (this.state.findingsStats.medium + changeMedium),
low: (this.state.findingsStats.low + changeLow)
}
})
}
drawUserInfo(user, index) {
let imgStyle = {
height: '47px',
width: '42px',
padding: '1px 1px 8px 1px'
};
let imgDivStyle = {
display: 'inline-block',
margin: '0px 2px',
backgroundColor: user.color
};
let divStyle = {
display: 'inline-block',
marginRight: '10px',
textAlign: 'center'
};
return (
<div key={index} style={divStyle}>
<div style={imgDivStyle}>
<img src={user.picture} style={imgStyle} alt={user.username} />
</div>
<p><small>{user.username}</small></p>
</div>
);
}
openUpdateModal(event) {
let task = this.state.projectMeta.tasks[event.target.getAttribute("datatask")];
this.setState({
creating: false,
updateUuid: event.target.getAttribute('datatask'),
createTask: {
title: task.title,
description: task.explanation,
users: task.users
}
});
this.openCreationModal();
}
openNewTaskModal() {
this.setState({
creating: true,
updateUuid: '',
createTask: {
title: '',
description: '',
users: ''
}
});
this.openCreationModal();
}
openCreationModal() {
this.setState({ creationModalIsOpen: true });
}
afterOpenCreationModal() {
//Don't know if we need extra code here?
}
closeCreationModal() {
this.setState({
creationModalIsOpen: false,
});
}
handleChangeTaskTitle(event) {
this.setState({
createTask: {
title: event.target.value,
description: this.state.createTask.description,
users: this.state.createTask.users
}
})
}
handleChangeTaskDescription(event) {
this.setState({
createTask: {
title: this.state.createTask.title,
description: event.target.value,
users: this.state.createTask.users
}
})
}
handleChangeTaskUsers(event) {
var options = event.target.options;
var value = [];
for (var i = 0, l = options.length; i < l; i++) {
if (options[i].selected) {
value.push(options[i].value);
}
}
this.setState({
createTask: {
title: this.state.createTask.title,
description: this.state.createTask.description,
users: value
}
})
}
createTask() {
console.log(this.state.createTask);
if (this.state.createTask.title === '' || this.state.createTask.description === '' || this.state.createTask.users.length <= 0) {
NotificationManager.error('Make sure to fill all fields', 'Error Message');
} else {
let body = {
projectUuid: this.state.projectInfo.projectUuid,
title: this.state.createTask.title,
explanation: this.state.createTask.description,
users: this.state.createTask.users,
notes: []
};
RequestService.Post('project/task/add', body).then(d => {
this.props.getProjectMeta();
this.closeCreationModal();
this.setState({
createTask: {
title: '',
description: '',
users: []
}
});
NotificationManager.success('Added the new Task', 'Success!')
}).catch(e => {
console.log(e);
NotificationManager.error(e, 'Error Message');
})
}
}
deleteTask(event) {
let body = {
projectUuid: this.state.projectInfo.projectUuid,
taskUUID: event.target.getAttribute('datauuid')
}
RequestService.Post('project/task/delete', body).then(d => {
console.log(d);
this.props.getProjectMeta()
NotificationManager.success("Removed", "Removed task")
// window.location.reload();
});
}
updateTask(event) {
console.log(event.target.getAttribute("datatask"));
let task = this.state.projectMeta.tasks[event.target.getAttribute("datatask")];
let body = {
projectUuid: this.state.projectInfo.projectUuid,
title: this.state.createTask.title,
explanation: this.state.createTask.description,
users: this.state.createTask.users,
notes: [],
completed: task.completed,
taskUUID: event.target.getAttribute("datatask")
};
RequestService.Post('project/task/update', body).then(d => {
console.log(d);
// This should work online but isn't
this.props.getProjectMeta();
this.closeCreationModal();
this.setState({
createTask: {
title: '',
description: '',
users: []
}
});
NotificationManager.success("Succes", "Succesfully updated Task")
}).catch(e => {
NotificationManager.error("Error", "Something went wrong with deleting");
console.log(e);
})
}
calculateNewPercentage() {
let completedSum = 0;
for (let taskUUID in this.state.projectMeta.tasks) {
if (this.state.projectMeta.tasks[taskUUID].completed) {
completedSum++;
}
}
let proPre = 0;
if (this.state.projectMeta.tasks && Object.keys(this.state.projectMeta.tasks).length > 0) {
proPre = Math.round((completedSum / Object.keys(this.state.projectMeta.tasks).length) * 100);
}
this.setState({
progressStyle: {
width: proPre + '%'
},
progressPercentage: proPre
});
}
completedSwitch(event) {
let meta = this.state.projectMeta;
let taskUUID = event.target.getAttribute("datatask");
meta.tasks[taskUUID].completed = !meta.tasks[taskUUID].completed;
this.setState({ projectMeta: meta });
this.calculateNewPercentage();
let body = {
projectUuid: this.state.projectInfo.projectUuid,
title: meta.tasks[taskUUID].title,
explanation: meta.tasks[taskUUID].explanation,
users: meta.tasks[taskUUID].users,
notes: meta.tasks[taskUUID].notes,
completed: meta.tasks[taskUUID].completed,
taskUUID: taskUUID
}
RequestService.Post('project/task/update', body).then(d => {
console.log(d);
// NotificationManager.success("Succes", "Succesfully updated Task")
});
}
renderUsersInTable(userUUIDS) {
let users = []
for (let uuid in userUUIDS.users) {
let tempUsers = this.state.projectUsers[userUUIDS.users[uuid]];
if (tempUsers) {
users.push(tempUsers);
}
}
return users;
}
drawUserInfoSmall(user, index) {
let imgStyle = {
height: '41px',
width: '36px',
padding: '1px 1px 6px 1px'
};
let divStyle = {
display: 'inline-block',
margin: '0px 2px',
backgroundColor: user.color
};
return (
<div key={index} style={divStyle}>
<img src={user.picture} style={imgStyle} alt={user.username} />
</div>
);
}
renderTasks() {
if (!this.state.projectMeta.tasks) {
return;
}
let tasks = this.state.projectMeta.tasks;
let components = [];
let counter = 0;
for (var taskUUID in tasks) {
let status = "";
if (tasks[taskUUID].completed) {
status = (
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" datatask={taskUUID}>
<path d="M0 0h24v24H0z" fill="none" datatask={taskUUID} />
<path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" datatask={taskUUID} />
</svg>
)
} else {
status = (
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" datatask={taskUUID}>
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" datatask={taskUUID} />
<path d="M0 0h24v24H0z" fill="none" datatask={taskUUID} />
</svg>
)
}
components.push(
<tr key={counter}>
<td>{tasks[taskUUID].title}</td>
<td>{tasks[taskUUID].explanation}</td>
<td>
{
this.renderUsersInTable(tasks[taskUUID]).map((item, index) => (
this.drawUserInfoSmall(item, index)
))
}
</td>
{/* <td>{String(tasks[taskUUID].notes)}</td> */}
<td onClick={this.completedSwitch} datatask={taskUUID}>{status}</td>
<td>
<div className="edit-buttons" role="group" aria-label="Edit" >
<button type="button" className="btn btn-sm btn-primary-outline" datatask={taskUUID} onClick={this.openUpdateModal}>
<svg fill="#FFFFFF" height="16" viewBox="0 0 24 18" width="16" xmlns="http://www.w3.org/2000/svg" className="edit-button-icon" >
<path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" />
<path d="M0 0h24v24H0z" fill="none" />
</svg>
</button>
<button type="button" className="btn btn-sm btn-primary-outline" datauuid={taskUUID} onClick={this.deleteTask}>
<svg fill="#FFFFFF" height="16" viewBox="0 0 24 18" width="16" xmlns="http://www.w3.org/2000/svg" className="remove-button-icon">
<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" />
<path d="M0 0h24v24H0z" fill="none" />
</svg>
</button>
</div>
</td>
</tr>
)
counter++;
}
return components;
}
renderUserOptions() {
let results = [];
let counter = 0;
for (let uuid in this.state.projectUsers) {
results.push(<option key={counter} value={uuid}>{this.state.projectUsers[uuid].username}</option>);
counter++;
}
return results;
}
renderModalButton() {
if (this.state.creating) {
return <button className="btn btn-primary btn-modal" onClick={this.createTask}>Create</button>
} else {
return <button className="btn btn-primary btn-modal" datatask={this.state.updateUuid} onClick={this.updateTask}>Update</button>
}
}
render() {
if (!this.state.projectMeta || !this.state.projectInfo || !this.state.projectUsers || Object.keys(this.state.projectUsers).length <= 0) {
return (
<div className="loading-icon-wrapper" >
<div><img src="/img/eyLogoLoading.gif" className="loading-icon" alt="loading" width="100px" height= "100px"/></div>
</div>
)
}
return (
<div className="col-xl-10 col-md-9 col-sm-8">
<div className="row">
<div className="col-md-4">
<h3>Metadata</h3>
<p>Created on: {this.state.projectMeta.createdOn}</p>
<p>Created by: {this.state.projectUsers[this.state.projectMeta.createdBy].username}</p>
</div>
<div className="col-md-4">
<h3>Status</h3>
<div className="row">
<div className="col-3">
<div className="hexagon hexagon-critical">
<svg id="color-fill" xmlns="http://www.w3.org/2000/svg" version="1.1" width="60" height="60" >
<polygon className="hex" points="60,30 45,56 15,56 0,30 15,4 45,4"></polygon>
</svg>
<div className="hexagon-text">
{this.convertNumberToTwo(this.state.findingsStats.critical)}
</div>
<div className="hexagon-sub">Critical</div>
</div>
</div>
<div className="col-3">
<div className="hexagon hexagon-high">
<svg id="color-fill" xmlns="http://www.w3.org/2000/svg" version="1.1" width="60" height="60" >
<polygon className="hex" points="60,30 45,56 15,56 0,30 15,4 45,4"></polygon>
</svg>
<div className="hexagon-text">
{this.convertNumberToTwo(this.state.findingsStats.high)}
</div>
<div className="hexagon-sub">High</div>
</div>
</div>
<div className="col-3">
<div className="hexagon hexagon-medium">
<svg id="color-fill" xmlns="http://www.w3.org/2000/svg" version="1.1" width="60" height="60" >
<polygon className="hex" points="60,30 45,56 15,56 0,30 15,4 45,4"></polygon>
</svg>
<div className="hexagon-text">
{this.convertNumberToTwo(this.state.findingsStats.medium)}
</div>
<div className="hexagon-sub">Medium</div>
</div>
</div>
<div className="col-3">
<div className="hexagon hexagon-low">
<svg id="color-fill" xmlns="http://www.w3.org/2000/svg" version="1.1" width="60" height="60" >
<polygon className="hex" points="60,30 45,56 15,56 0,30 15,4 45,4"></polygon>
</svg>
<div className="hexagon-text">
{this.convertNumberToTwo(this.state.findingsStats.low)}
</div>
<div className="hexagon-sub">Low</div>
</div>
</div>
</div>
<br />
<p><b>Task completed</b></p>
<div className="progress">
<div className="progress-bar" role="progressbar" style={this.state.progressStyle} aria-valuenow={this.state.progressPercentage} aria-valuemin="0" aria-valuemax="100">{this.state.progressPercentage}%</div>
</div>
</div>
<div className="col-md-4">
<h3>Modules</h3>
<ToolbarContainer projectUuid={this.state.projectInfo.projectUuid} getProjectMeta={this.props.getProjectMeta} />
</div>
</div>
<hr />
<h3>Tasks </h3>
{/* <br /> */}
<table className="table table-sm table-bordered table-hover">
<thead>
<tr>
<th className="col-2">Title</th>
<th className="col-3">Description</th>
<th className="col-2">User(s)</th>
{/* <th className="col-2">Note(s)</th> */}
<th className="col-1">Completed</th>
<th className="col-1"><button type="button" className="btn btn-primary" onClick={this.openNewTaskModal}>Create Task</button></th>
</tr>
</thead>
<tbody>
{this.renderTasks()}
</tbody>
</table>
<FindingsPart findings={this.state.projectMeta.findings} projectUuid={this.state.projectInfo.projectUuid} changeFindings={this.changeFindingStats} />
<Modal isOpen={this.state.creationModalIsOpen} ariaHideApp={false} onAfterOpen={this.afterOpenCreationModal} onRequestClose={this.closeCreationModal} className="custom-modal" contentLabel="Create Project" >
<h1>Create Task</h1>
<hr />
<div className="form-group">
<label>Title</label>
<input type="text" className="form-control" id="inputTaskTitle" defaultValue={this.state.createTask.title} onChange={this.handleChangeTaskTitle} />
</div>
<div className="form-group">
<label>Description</label>
<textarea type="text" className="form-control" id="inputTaskDescription" defaultValue={this.state.createTask.description} onChange={this.handleChangeTaskDescription} />
</div>
<div className="form-group">
<label>Assignee</label>
<select className="form-control" multiple="5" defaultValue={this.state.createTask.users} onChange={this.handleChangeTaskUsers}>
{this.renderUserOptions()}
</select>
</div>
<hr />
{this.renderModalButton()}
<button className="btn btn-primary btn-modal" onClick={this.closeCreationModal}>Close</button>
</Modal>
<NotificationContainer />
</div>
);
}
}
export default Overview;
|
import React from 'react';
import { Grid, Typography } from '@material-ui/core';
import MyPost from './Post/UserPost';
import useStyles from './styles';
import { Ripple } from 'react-spinners-css';
const MyPosts = ({ currentUserPosts }) => {
const classes = useStyles();
console.log(currentUserPosts);
return !currentUserPosts ? <Ripple color="#477bff" style={{ marginLeft: '45%', marginTop: '15%' }} size={50} /> : currentUserPosts.length === 0 ? <Typography className={classes.eror}>No posts to show...</Typography> : (
<Grid className={classes.container} container alignItems="stretch" spacing={3}>
{currentUserPosts.map((post) => (
<Grid key={post._id} item xs={12} sm={6} md={4}>
<MyPost post={post} />
</Grid>
))}
</Grid>
)
}
export default MyPosts;
|
import request from 'lib/request';
import { loginQuery } from 'queries/login';
import { RESET_STATE, AUTH_ERROR } from 'constants/action-types';
import { isLoading } from 'actions';
export const signInUser = async ({ email, password }) => {
const query = loginQuery(email, password)
dispatch(isLoading(true));
try {
const response = await request(query);
const { data } = response.data;
const token = data.login.token;
if (token) {
localStorage.setItem('token', token);
}
dispatch(isLoading(false));
dispatch(push('/map'));
}
catch (error) {
alert(error);
dispatch(authError(error.message));
dispatch(isLoading(false));
}
}
// export const signOut = () => {
// localStorage.removeItem('token');
// dispatch(RESET_STATE, []);
// }
export const authError = (error) => dispatch(AUTH_ERROR, error)
|
export const fruitMixin = {
data() {
return {
fruits: ["Apple", "Banana", "Mango", "Melon"],
filterText: ""
};
},
computed: {
filteredFruits() {
return this.fruits.filter(element =>
element.toLowerCase().match(this.filterText.toLowerCase())
);
}
}
};
// Essentially a shared 'service'-like thing
// HOWEVER, the data is NOT SHARED between all components. Instead, each component gets a COPY
|
require('dotenv').config();
const express = require('express');
const app = express();
app.use(express.json());
app.use(express.urlencoded({extended: true})); //req.body < data
app.post('/compute', (req, res) => { //route
const { age, cre, dia, eje, bp, plt, ser, seso ,secre, sex, smok, time} = req.body;
console.log(age, cre, dia, eje, bp, plt, ser, seso, sex, smok, time, secre);
//There you have to do the runtime environment thing
res.send("Tm maroge");
});
app.listen(process.env.PORT, () => console.log(`Server started on port: ${process.env.PORT}`));
|
import React, { useState, useEffect } from "react";
import { useStore } from "./useStore";
import Ajax from "ui/business/hooks/helpers/ajax";
export default function useAction({ name }) {
const { state, dispatch } = useStore();
const [response, setData] = useState([]);
const [metadata, setMetaData] = useState([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState({ message: null });
const ajax = new Ajax(state, dispatch);
async function action({ metadata, action, ids }) {
setError({ message: null, success: false });
setLoading(true);
try {
const responseData = await ajax.post({
path: `crm/${name}/${action}`,
body: { ids: ids }
});
setData(responseData);
setError({ message: null, success: true });
setLoading(false);
return Promise.resolve(responseData);
} catch (e) {
setLoading(false);
setError({ ...e, success: false });
return Promise.reject(e);
}
}
return { action, response, loading, error, setMetaData };
}
|
import React, { Component } from "react";
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
import { connect } from "react-redux";
import { submitReview } from "../../actions/reviewActions";
import { Button, Input } from "@material-ui/core/";
import {
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle
} from "@material-ui/core/";
import { Check, RateReview } from "@material-ui/icons/";
import { isWidthDown } from "@material-ui/core/withWidth";
import ReactStars from "react-stars";
import withWidth from "@material-ui/core/withWidth";
const styles = {};
class ReviewRating extends Component {
constructor(props) {
super(props);
this.state = {
open: false,
starReview: 0,
comment: ""
};
this.handleCloseReviewForm = this.handleCloseReviewForm.bind(this);
this.handleOpenReviewForm = this.handleOpenReviewForm.bind(this);
this.ratingChanged = this.ratingChanged.bind(this);
this.handleReviewInput = this.handleReviewInput.bind(this);
this.handleCancelReview = this.handleCancelReview.bind(this);
}
componentWillMount() {
this.setState({
starReview: this.props.booking.starReview,
comment: this.props.booking.comment
});
}
handleCancelReview(event) {
event.stopPropagation();
this.setState({ open: false });
}
handleOpenReviewForm(event) {
event.stopPropagation();
this.setState({ open: true });
}
handleCloseReviewForm(event, bookingID) {
event.stopPropagation();
this.setState({ open: false });
const reviewData = {
bookingID: bookingID,
starRating: this.state.starReview,
comment: this.state.comment
};
this.props.submitReview(reviewData);
}
handleReviewInput(event) {
this.setState({
comment: event.target.value
});
}
ratingChanged(newRating) {
this.setState({
starReview: newRating
});
}
render() {
const width = this.props.width;
const { classes, booking } = this.props;
return (
<div>
<Dialog
open={this.state.open}
onClose={this.handleCancelReview}
aria-labelledby="form-dialog-title"
maxWidth="sm"
fullWidth="true"
>
<DialogTitle
id="form-dialog-title"
style={{
background: "linear-gradient(to right, #0c4b78, #3d4e96, #2c76a9)"
}}
>
<div style={{ color: "white" }}>Rate and Review</div>
</DialogTitle>
<DialogContent>
<DialogContentText style={{ marginBottom: 10, marginTop: 22 }}>
{isWidthDown("xs", width)
? "This is a public review" // render this if it is opened on a phone
: "Your review will be posted publicly on the web"}
</DialogContentText>
<ReactStars
count={5}
size={24}
color2={"#ffd700"}
value={this.state.starReview}
onChange={this.ratingChanged}
/>
<div>
<Input
multiline
placeholder={
isWidthDown("xs", width)
? "" // render this if it is opened on a phone
: "Share details of your own experience at this hotel"
}
style={{
width: isWidthDown("xs", width) ? 232 : 450,
marginTop: 13
}}
value={this.state.comment}
onChange={this.handleReviewInput}
/>
</div>
</DialogContent>
<DialogActions>
<Button color="primary" onClick={this.handleCancelReview}>
Cancel
</Button>
<Button
onClick={event =>
this.handleCloseReviewForm(event, booking.bookingID)
}
color="primary"
>
Post
</Button>
</DialogActions>
</Dialog>
{booking.comment === "" && booking.starReview === 0 ? ( // if reviews were left, change to ReviewedButton
<Button
variant="contained"
size="small"
className={this.props.ReviewButtonStyle}
onClick={this.handleOpenReviewForm}
>
<RateReview style={{ fontSize: 16 }} />
Review
</Button>
) : (
<Button
variant="contained"
size="small"
className={this.props.ReviewedButtonStyle}
onClick={this.handleOpenReviewForm}
>
<Check style={{ fontSize: 16 }} />
Reviewed
</Button>
)}
</div>
);
}
}
const mapStateToProps = state => ({});
export default connect(
mapStateToProps,
{ submitReview }
)(withStyles(styles)(withWidth()(ReviewRating)));
|
import h from 'mithril/hyperscript'
import connect from '../../../../src/connect.js'
function list ({items}, intents) {
return h('ul.todo-list',
items.map(item => {
const active = item.active || false
const edit = item.edit || false
if (edit) {
return h('input.u-full-width[type="text"][name="todo"]', {
oncreate: ({dom}) => {
dom.focus()
},
value: item.name,
onkeydown: e => {
if (e.keyCode === 13) {
intents('Todo', 'saveTodo', {name: e.target.value, id: item.id})
e.target.value = ''
}
},
onblur: e => {
intents('Todo', 'editTodo', null)
},
autofocus: false
})
}
return h('li', {
className: !active && 'todo-completed',
ondblclick: () => {
intents('Todo', 'editTodo', item.id)
}
},
h('label.todo-checkbox',
h('input[type="checkbox"]', {
checked: !item.active,
onclick: () => {
intents('Todo', 'doneTodo', item.id)
}
})
),
item.name,
h('span.remove-todo', {
onclick: () => {
intents('Todo', 'deleteTodo', item.id)
}
}, 'x')
)
})
)
}
export default () => connect({
modules: 'Todo'
}, list)
|
import React from 'react';
import '../announcements/announcements.css';
export default class editAnnouncement extends React.Component {
state = {
title: '',
body: '',
creator: '',
id: '',
success: false
}
onSubmit = e => {
const requestOptions = {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title: this.state.title, description: this.state.body, id: this.state.id, creator: this.state.creator }),
mode: 'cors',
};
fetch('http://localhost:5000/events/update/' + this.state.id, requestOptions).then(response => this.setState({
title: '',
body: '',
creator: '',
id: '',
success: true
}));
}
render() {
const { state } = this;
return (
<div className="announcement-container">
<div className="title-container">
<b>Edit an event</b>
</div>
<div className="admin-event-edit-post">
<div>
<label className="announcement-form"><p className="announcement-p">Title:</p>
<input
type="text"
value={state.title}
onChange={e => this.setState({ title: e.target.value })}
className="announcement-input" />
</label>
</div>
<div>
<label className="announcement-form"> <p className="announcement-p">Body: </p>
<input
type="text"
value={state.body}
onChange={e => this.setState({ body: e.target.value })}
className="announcement-input" />
</label>
</div>
<div>
<label className="announcement-form"> <p className="announcement-p">Body: </p>
<input
type="text"
value={state.creator}
onChange={e => this.setState({ creator: e.target.value })}
className="announcement-input" />
</label>
</div>
<div>
<label className="announcement-form"><p className="announcement-p">Id: </p>
<input
type="text"
value={state.id}
onChange={e => this.setState({ id: e.target.value })}
className="announcement-input" />
</label>
<input type="submit" value="Submit" onClick={() => this.onSubmit()} />
</div>
{this.state.success && <p> Event has been edited!</p>}
</div >
</div >
)
}
}
|
import React from 'react'
import { connect } from 'redux-bundler-react'
import PropTypes from 'prop-types'
class HomePage extends React.Component {
static propTypes = {
hasGroup: PropTypes.bool.isRequired,
doCreateGroup: PropTypes.func.isRequired
}
render () {
return (
<div>
{this.props.hasGroup ? (
<div>
<h1>Welcome to DAT LUNCH!?</h1>
<a href='/add-eater'>ADD EATER!!!</a>
</div>
) : (
<button onClick={this.props.doCreateGroup}>Create Group</button>
)}
</div>
)
}
}
export default connect('selectHasGroup', 'doCreateGroup', HomePage)
|
describe('Base test', () => {
it('Test runns', () => {
});
});
|
import React, { Component } from 'react'
import stylesheetGridlex from 'styles/gridlex.min.css'
import animateScrollTo from 'animated-scroll-to'
import stylesheet from 'styles/investor.scss'
import { default as Layout } from '../components/layout/layout'
import { Media } from '../components/media'
import { MediaCTA } from '../components/media-cta'
import { InvestorHighlight } from '../components/highlights'
import Cube from '../static/assets/cube.png'
import IndustryValueMobile from '../static/assets/Industry Value Graph Mobile v2.png'
import Roi from '../static/assets/roi.png'
import {
mediaVerticals,
highlights,
stats,
reasons
} from '../components/constants/investor'
import { SecondaryPageContainer } from '../components/layout/container'
import { Button } from '../components/button'
class Investor extends Component {
constructor(props) {
super(props)
this.scrollToIndustries = this.scrollToIndustries.bind(this)
}
componentDidMount() {
const href = window.parent.location.href
if (href.indexOf('#industries') !== -1) {
this.scrollToIndustries()
}
}
scrollToIndustries() {
const el = this.el
animateScrollTo(0, {
minDuration: 750,
horizontal: false,
offset: el.offsetTop - 250
})
}
render() {
const highlightsToRender = highlights.map(details => (
<InvestorHighlight
key={details.title}
content={details.content}
title={details.title}
/>
))
const industryValueDesktopToRender = (
<div className="grid Investor__chart">
{stats.map(val => (
<div key={val.value} className="col" style={{ position: 'relative' }}>
<div className="Investor__chart-col-wrapper">
<b className="Investor__chart-value">{val.value} T$</b>
<div
className="Investor__chart-column"
style={{ height: val.height }}
/>
<div style={{ height: '37px' }}>
<p className="Investor__chart-area-text">{val.area}</p>
</div>
</div>
</div>
))}
</div>
)
const industryValueMobileToRender = (
<div>
<img
alt="Industry Value"
className="Investor__chart--is-mobile-image"
src={IndustryValueMobile}
/>
</div>
)
const mediaContent = {
title: 'Industries which have already began automating with IoT',
content: industryValueDesktopToRender,
isCentered: true
}
const reasonsToRender = (
<div className="Investor__reasons">
{reasons.map(val => (
<div key={val.header} className="Investor__reasons-group">
<b>{val.header}</b>
<p>{val.description}</p>
</div>
))}
</div>
)
const mediaIndustriesDesktop = [mediaContent]
const mediaIndustriesMobile = [
{ ...mediaContent, content: industryValueMobileToRender }
]
return (
<Layout>
<SecondaryPageContainer>
<div className="Investor">
<style dangerouslySetInnerHTML={{ __html: stylesheetGridlex }} />
<style dangerouslySetInnerHTML={{ __html: stylesheet }} />
<div style={{ padding: '0px 5%' }}>
<div className="grid-middle Investor__media">
<div className="col-3 col_sm-12 col_sm-last col_md-first col_lg-first MediaCTA__image-wrapper">
<img src={Roi} className="Investor__img-roi" />
</div>
<div className="col-9 col_sm-12 col_sm-first col_md-last col_lg-last">
<MediaCTA
title="Why invest in IoT?"
content={
'<p style="margin-bottom: 0px;">The Internet has changed the course of humanity. Now there’s a new technological revolution on its way: machines. It’s predicted that by 2025, some 50 billion IoT devices will generate an astonishing $11.1 trillion in revenue. Traditionally, only exclusive investment funds could take advantage of this emerging economy, but with MyBit it’s open to everyone.</p><p style="margin: 0px;">And that’s just one of the reasons to invest:</p>'
}
isLeft
/>
{reasonsToRender}
</div>
</div>
<div className="Investor__verticals">
<Media media={mediaVerticals} />
</div>
<div
ref={el => {
this.el = el
}}
className="Investor__highlights grid-center"
>
{highlightsToRender}
</div>
<div className="Investor__industry-value--is-desktop">
<Media media={mediaIndustriesDesktop} />
</div>
<div className="Investor__industry-value--is-mobile">
<Media media={mediaIndustriesMobile} />
</div>
<div className="grid-middle Investor__who">
<div className="col-9 col_sm-12">
<MediaCTA
title="Who can Invest?"
content={
'<p>Anyone. Unlike traditional investment funds that require unrealistic amounts of capital for 99% of people, MyBit ensures everyone can access the best investment opportunities.</p><p>We believe in a fair, open market that’s driven by technology for the benefit of people, not investment funds. Harnessing the power of Blockchain technology, we’re revolutionizing investing; we’re creating a future where it’s easier, faster and safer for everyone.</p>'
}
isRight
/>
</div>
<div className="col-3 col_sm-12 MediaCTA__image-wrapper">
<img src={Cube} className="Investor__img-cube" />
</div>
</div>
<div className="Investor__join-alpha">
<MediaCTA
title="Sign up for the Alpha"
content={
<Button
label={'Start Here'}
url={'https://alpha.mybit.io'}
className={'Investor__btn-start-here'}
isLink
isCentered
/>
}
/>
</div>
</div>
</div>
</SecondaryPageContainer>
</Layout>
)
}
}
export default Investor
|
import React from 'react';
const StaffBox = (props) => {
return (
<div className="staff-box">
<div className='staff-box__name'>{props.person.name}</div>
<div className="staff-box__title">{props.person.title}</div>
<img alt="staffPhoto" className="staff-box__photo" src={props.person.photo} />
</div>
)
}
export default StaffBox;
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const DataHelper_1 = require("../../../helpers/DataHelper");
class Statement {
constructor(model) {
if (!model)
return;
this._id = DataHelper_1.default.handleIdDataModel(model._id);
this.userId = DataHelper_1.default.handleIdDataModel(model.userId);
this.month = model.month;
this.year = model.year;
this.type = model.type;
this.accountId = model.accountId;
this.openBalance = model.openBalance;
this.closeBalance = model.closeBalance;
this.transactionFailed = model.transactionFailed;
this.manualStatement = model.manualStatement;
this.createdAt = model.createdAt;
this.updatedAt = model.updatedAt;
}
static parseArray(list) {
return list && Array.isArray(list) ? list.map(item => new Statement(item)) : [];
}
}
Object.seal(Statement);
exports.default = Statement;
|
class Line {
// NEW
fitness = 0; //El fitness del line
isBest = false; //Variable para saber si el line es el mejor de la generacion
dead = false; //Variable para saber si el line esta terminado o no
pathArray = []
distance = 0
passengers = 0
//Constructor
constructor(pathArray) {
this.pathArray = pathArray
}
//Funcion para dibujar los lines
show() {
}
//Funcion de movimiento del line
move() {
}
//Funcion para actualizar. Si el line esta muerto, no se movera
update() {
this.move()
}
//Funcion que retorna un line hijo con la informacion del padre
returnBaby() {
let baby = new Line();
baby.pathArray = [...this.pathArray]
return baby;
}
// Cambia la posicion del pathArray
mutate() {
let mutationRate = 0.1
for (let i = 0; i < this.pathArray.length; i++) {
if(Math.random()< mutationRate){
let aux = this.pathArray[i]
let newPos = Math.floor(Math.random() * 8)
this.pathArray[i] = this.pathArray[newPos]
this.pathArray[newPos] = aux
}
}
this.pathArray
}
//Calculamos el fitness con la logica mencionada en el documento
calcFitness(){
let fitnessMul = 1.0
let knownCities = []
this.distance = 0
this.passengers = 0
for (let i = 0; i < distancesMatrix.length-1; i++) {
if(knownCities.includes(this.pathArray[i])){ //Se verifica que no se repitan, y si es asi lo penalizamos
fitnessMul = fitnessMul * 0.65
}
else
knownCities.push(this.pathArray[i])
this.distance += distancesMatrix[this.pathArray[i]][this.pathArray[i+1]]
this.passengers += passengerMatrix[this.pathArray[i]][this.pathArray[i+1]]
}
this.fitness = (this.passengers/this.distance * this.passengers/totalPassengers * 1000) * fitnessMul
}
}
|
{
"class" : "Page::ring::reset_pass",
"command" : {
"reset" : "reset"
},
"template" : "reset_pass.html"
}
|
import "./styles.css";
import Navbar from "./components/Navbar/navbar";
import Lembretes from "./components/Lembretes/task";
import { useState } from "react";
const task = {
id: 0,
title: "Novo lembrete",
state: "pendente"
};
let ContId = 0;
const geraId = () => {
ContId++;
return ContId;
};
export default function App() {
const [tasks, setTasks] = useState({});
const addLembrete = (title, state) => {
const newtask = {
id: geraId(),
title,
state
};
setTasks((lembretesExistentes) => {
return [...lembretesExistentes, newtask];
});
};
return (
<div className="App">
<Navbar />
<div className="container">
<Lembretes title="A fazer" onAddLembrete={addLembrete} tasks={tasks} />
</div>
</div>
);
}
|
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'Inicio',
component: () => import( '../views/Inicio.vue')
},
{
path: '/equipo',
name: 'equipo',
component: () => import( '../views/Equipo.vue')
},
{
path: '/detalletrabajador',
name: 'detalletrabajador',
component: () => import( '../components/DetalleTrabajador.vue')
},
{
path: '/detallepoblacion',
name: 'detallepoblacion',
component: () => import( '../components/DetallePoblacion.vue')
},
{
path: '/circuitos',
name: 'circuitos',
component: () => import( '../views/Circuitos.vue')
},
{
path: '/instituciones-circuito',
name: 'instituciones-circuito',
component: () => import( '../components/InstitucionesCircuito.vue')
},
{
path: '/instituciones',
name: 'instituciones',
component: () => import( '../views/Instituciones.vue')
},
{
path: '/poblacion',
name: 'poblacion',
component: () => import( '../views/Poblacion.vue')
},
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router
|
import { validStars } from "github-query-validator";
import { queryValidator } from "github-query-validator";
export const validateStars = input => {
if (!validStars(input)) {
return "You are looking at wrong stars";
}
};
export const validateQuery = input => {
if (!queryValidator(input)) {
return "You must enter a valid query";
}
};
export const requiredInput = input => {
return input ? undefined : `Input is required`;
};
//
// function requiredField(field, input) {
// debugger;
// let noInputErrorMapper = {
// query: field => {
// return `You must provide a ${field}`;
// },
// stars: () => {
// return `You must try to look for some starry repos`;
// }
// };
// return function requiredInput(field) {
// debugger;
// return noInputErrorMapper[field](field);
// };
// }
// function validationFn(values) {
// const errors = {};
//
// let requiredFields = ["query", "stars"];
//
// let noValueErrorMapper = {
// query: field => {
// return `You must provide a ${field}`;
// },
// stars: () => {
// return `You must try to look for some starry repos`;
// }
// };
// function starsValidator(field, input) {
// return validStars(input);
// }
// function isValidField(field, input) {
// let invalidErrorMapper = {
// query: input => {
// return true;
// },
// stars: input => {
// return starsValidator(input);
// }
// };
// return invalidErrorMapper[field](input);
// }
// requiredFields.forEach(field => {
// if (!values[field]) {
// errors[field] =
// noValueErrorMapper[field] && noValueErrorMapper[field](field);
// }
// else if (!isValidField(field, values[field])) {
// errors[field] = "enter valid value";
// }
// });
// return errors;
// }
|
import React from 'react';
import PropTypes from 'prop-types';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
faSortDown,
faSortUp,
faSort,
} from '@fortawesome/free-solid-svg-icons';
import s from './ColumnHeader.css';
/* eslint-disable css-modules/no-undef-class */
const ColumnHeader = ({
sortFunction,
sortedBy,
showingName,
originalName,
order,
isSortable,
hide,
width,
}) => {
const showSortIcon = () => {
if (sortedBy === '')
return <FontAwesomeIcon className="ml-1" icon={faSort} />;
else if (sortedBy === originalName && order === 'ASC')
return <FontAwesomeIcon className="ml-1" icon={faSortUp} />;
else if (sortedBy === originalName)
return <FontAwesomeIcon className="ml-1" icon={faSortDown} />;
return <FontAwesomeIcon className="ml-1" icon={faSort} />;
};
return (
<td
className={hide ? s.hide : undefined}
style={{ width }}
role="presentation"
onClick={() => sortFunction(originalName, order)}
>
<span className={s.columnHeader}>
{showingName} {isSortable && showSortIcon()}
</span>
</td>
);
};
ColumnHeader.propTypes = {
sortFunction: PropTypes.func.isRequired,
sortedBy: PropTypes.string.isRequired,
showingName: PropTypes.string.isRequired,
originalName: PropTypes.string.isRequired,
order: PropTypes.string.isRequired,
isSortable: PropTypes.bool.isRequired,
hide: PropTypes.bool.isRequired,
width: PropTypes.string.isRequired,
};
export default withStyles(s)(ColumnHeader);
|
/**
* Created by Administrator on 2018-02-26.
*/
module.exports = (sequelize, DataTypes) => {
var ClientPart = sequelize.define('client_part', {
id: {
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
autoIncrement: true
},
key: DataTypes.INTEGER,
sort: DataTypes.INTEGER,
type: DataTypes.STRING(50),
title: DataTypes.STRING(100),
action: DataTypes.STRING(255),
description: DataTypes.STRING(255),
}, {
classMethods: {
associate: function(models) {
// associations can be defined here
}
}
}, {
timestamps: false
});
return ClientPart;
};
|
let producto = document.getElementById('collecttion')
let shop = document.getElementById('shop')
let coleccion = document.getElementById('productos')
let canvas = document.getElementById('offcanvasExample')
let car = document.getElementById('car')
let acticulo = 'http://localhost:4000/articulos';
let cosasCompradas = 'http://localhost:4001/carrito';
let id = 0;
coleccion.addEventListener('click', async () => {
producto.innerHTML = ''
let rest = await fetch(acticulo)
let data = await rest.json()
data.forEach(pes => {
const { nombre, imagenPpal, id } = pes;
producto.innerHTML += `<div class="container card" style="width: 14rem;" id="cardProducto">
<img src="${imagenPpal}" class="card-img-top mt-3" alt="...">
<div class="card-body">
<h5 class="card-title d-flex justify-content-center"><strong>${nombre}</strong></h5>
<a href="#" onClick="buy(${id})" class="btn btn-primary d-flex justify-content-center">BUY IT</a>
</div>
`
})
})
const buy = (e) => {
swal.fire({
title: 'Product added in shop',
showConfirmButton: false,
timer: 1200
})
id = e;
}
shop.addEventListener('click', async () => {
producto.innerHTML = '<strong>Buy Products - Empty</strong>'
let rest = await fetch(acticulo)
let data = await rest.json()
let arregloBuscado = data.find(traer => traer.id == id)
let imagenPpal = arregloBuscado.imagenPpal;
let imagen1 = arregloBuscado.imagen1;
let imagen2 = arregloBuscado.imagen2;
producto.innerHTML = `<div class="container">
<div class="row">
<div class="col-2">
<a href="#" onClick="change('${imagenPpal}')" class="d-flex justify-content-center">
<img style="width:100px" src="${imagenPpal}" alt=""></a>
<a href="#" onClick="change('${imagen1}')" class="d-flex justify-content-center mt-3">
<img style="width:100px" src="${imagen1}" alt=""></a>
<a href="#" onClick="change('${imagen2}')" class="d-flex justify-content-center mt-3">
<img style="width:100px" src="${imagen2}" alt=""></a>
</div>
<div class="col-5">
<img id="imageChange" style="width:80%" src="${imagenPpal}" alt=""></div>
<div class="col-5">
<strong><h3 class="d-flex justify-content-left">${arregloBuscado.nombre}</h3></strong>
<h5 class="d-flex justify-content-left">$ ${arregloBuscado.precio}.00</h5>
<span class="d-flex mt-4">Size</span>
<div class="d-flex mt-3">
<a Style="text-decoration: none; color:black;" href="#" class="d-row p-3">S</a>
<a Style="text-decoration: none; color:black;" href="#" class="d-row p-3">M</a>
<a Style="text-decoration: none; color:black;" href="#" class="d-row p-3">L</a>
<a Style="text-decoration: none; color:black;" href="#" class="d-row p-3">XL</a>
<a Style="text-decoration: none; color:black;" href="#" class="d-row p-3">XXL</a>
</div>
<a href="#" onClick="Car(${id})" class="btn btn-dark d-flex justify-content-center mt-4">ADD TO CART</a>
<a href="#" onClick="buyNow(${id})" data-bs-toggle="offcanvas" data-bs-target="#offcanvasExample" aria-controls="offcanvasExample" class="btn btn-primary d-flex justify-content-center mt-2">BUY IT NOW</a>
<span class="d-flex justify-content-left mt-2"> ${arregloBuscado.descripcion}</span></div></div>`
})
const change = (p) => {
document.getElementById('imageChange').setAttribute('src', p);
}
async function buyNow(id) {
let rest = await fetch(acticulo);
let data = await rest.json()
let arregloBuscado = data.find(traer => traer.id == id)
canvas.innerHTML = '';
canvas.innerHTML += `<div class="offcanvas-header">
<h5 class="offcanvas-title" id="offcanvasExampleLabel"></h5>
<button type="button" class="btn-close text-reset float-end" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<div class="container">
<div class="row">
<div class="col-9">
<div class="card mt-3 border-0" style="max-width: 240px; max-height: 140px;">
<div class="row g-0">
<div class="col-md-4">
<img src="${arregloBuscado.imagenPpal}" style="height: 80%; width: 100%"
class="img-fluid rounded-start border-0 mt-1 ms-1" alt="...">
</div>
<div class="col-md-8">
<div class="card-body">
<h5 class="card-title">${arregloBuscado.nombre}</h5>
<p class="card-text">$ ${arregloBuscado.precio}.00</p>
</div>
</div>
</div>
</div>
</div>
<div class="col mt-4 text-center">
<input type="number" value="1" min="0" max="4"style="width: 60%">
<hr class="mt-4 text-dark">
<a href="#" id="shop" Style="text-decoration: none; color:black;"><strong>Remove</strong> </a>
</div>
</div>
</div>
<div class="container mt-4">
<div class="row">
<div class="col">
<strong>Subtotal</strong>
</div>
<div class="col d-flex justify-content-center me-0">$ ${arregloBuscado.precio}.00
</div>
</div>
<a href="#" onclick="comprado()" class="btn btn-primary d-flex justify-content-center mt-4 p-3"><strong>CHECK OUT</strong></a>
</div>`
}
function comprado() {
swal.fire({
title: 'Purchase Confirmed',
showConfirmButton: true,
confirmButtonText: 'Accept',
background: `rgba(238, 114, 52 )`
}).then((result) => {
if (result.isConfirmed) {
location.reload()
}
})
}
car.addEventListener('click', async () => {
let rest = await fetch(cosasCompradas);
let data = await rest.json()
let pagar = Object.values(data).reduce((acc, { cantidad, precio }) => acc + cantidad * Number(precio), 0)
let cantidad = Object.values(data).reduce((acc, { cantidad }) => acc + cantidad, 0)
producto.innerHTML = '';
producto.innerHTML = `<div class="container mt-4">
<table class="table">
<thead class="table-dark">
<tr>
<th scope="col m-0">Referencia</th>
<th scope="col">Nombre</th>
<th scope="col">Precio</th>
<th scope="col">Cantidad</th>
</tr>
</thead>
<tbody id="cosas">
</tbody>
<tfoot>
<td scope="row" class="m-4 fs-3"> <a class="btn btn-warning" onclick="yaaaa()">Buy</a> <a class="btn btn-danger" onclick="limpiar()">Limpiar Carrito</a></td><td></td><td>$ ${pagar}.00</td><td>${cantidad}</td>
</tfoot>
</table>
</div>`
let pintarCarro = document.getElementById('cosas')
data.forEach(traer => {
const { nombre, imagenPpal, precio, } = traer;
pintarCarro.innerHTML += `<td scope="row"><img style="height: 20%; width: 20%" src="${imagenPpal}" alt=""> </td><td>${nombre}</td><td>${precio}</td><td>${1}</td>`
})
})
async function Car(elementos) {
let rest = await fetch(acticulo);
let data = await rest.json()
let comprado = data.find(traer => traer.id == elementos)
// cosasCompradas
await fetch(cosasCompradas, {
method: 'POST',
body: JSON.stringify({
nombre: comprado.nombre,
imagenPpal: comprado.imagenPpal,
precio: comprado.precio,
cantidad: 1
}),
headers: {
"Content-Type": "application/json; charset=UTF-8"
}
})
}
function yaaaa(){
swal.fire({
title: 'Purchase Confirmed',
showConfirmButton: true,
confirmButtonText: 'Accept',
background: `rgba(238, 114, 52 )`
}).then((result) => {
if (result.isConfirmed) {
location.reload()
}
})
}
|
/**
* Created by victor on 12.03.15.
* logger winston
* https://www.npmjs.com/package/winston
*/
/**
* проблема с подсветкой в консоли, а так все норм.
* **/
var winston = require('winston');
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
colorize: 'true'
}),
new (winston.transports.File)({ filename: __dirname + '/log/logs.log' })
]
});
module.exports = logger;
|
export function newPushPull(push,pull) {
return { push : push
, send_callback : push.send_callback
, pull : pull
, grab_callback : pull.grab_callback
};
}
export function makeLifetimePush(send_callback, grab_callback) {
return { send_callback : send_callback
, grab_callback : grab_callback
};
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.