JSFiddle - React, Tailwind, and code Playground
by pmamode
HTML
<div class="members-wrapper"></div>
JavaScript
// define family array
var recordSet = [];
// define Person class
var RecordObject = function() {
this.name = "undefined";
this.recordParent = [];
this.recordProperty = [];
};
RecordObject.prototype.setRecord = function(obj) {
this.name = obj.name;
this.recordParent = obj.recordParent;
this.recordProperty = obj.recordProperty;
return this;
};
RecordObject.prototype.save = function() {
recordSet.push(this);
console.log(
"saving " + this.firstName + " : " + this.firstNameReference
);
// save to database here...
return this;
};
Person.prototype.stringify = function() {
console.log(JSON.stringify(family));
return this;
};
new Person()
.setPerson({
firstName: "Bob",
firstNameReference: [1, "family search", 5]
})
.save()
new Person()
.setPerson({
firstName: "Tammy",
firstNameReference: [5, "ancestry", 8]
})
.save()
.stringify();
// define Address class
var Address = function() {
this.id = 0;
this.address1 = "undefined";
this.address1Reference = [];
this.address2 = "undefined";
this.address2Reference = [];
this.city = "undefined";
this.cityReference = [];
this.suburb = "undefined";
this.suburbReference = [];
this.county = "undefined";
this.countyReference = [];
this.province = "undefined";
this.provinceReference = [];
this.state = "undefined";
this.stateReference = [];
this.zipPostalCode = "undefined";
this.zipPostalCodeReference = [];
this.country = "undefined";
this.countryReference = [];
};
// define Union class
var Union = function() {
this.id = 0;
this.fatherId = 0;
this.fatherReference = [];
this.motherId = 0;
this.motherReference = [];
this.children =[];
};
// define Union class
var Reference = function() {
this.id = 0;
this.content = undefined;
};