This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"filedata": [ | |
{ | |
"date_issued": "2018-03-27", | |
"transaction_type": "IMPORT", | |
"policy_number": "DSM/MARC/POL/0202762", | |
"open_cover": false, | |
"icc": "ICC-A", | |
"insured_name": "GALCO LIMITED", | |
"insured_email": "[email protected]", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"filedata": [ | |
{ | |
"date_issued": "2018-01-25", | |
"transaction_type": "IMPORT", | |
"policy_number": "jub/2018/0298", | |
"open_cover": true, | |
"endorsement_number": "jub/2018/0298/001", | |
"icc": "ICC-A", | |
"insured_name": "Another buyer", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data=[ | |
{ | |
"date_issued": "2018-01-25", | |
"transaction_type": "IMPORT", | |
"policy_number": "jub/2018/0298", | |
"OPEN COVER (YES or NO)": "YES", | |
"endorsement_number": "jub/2018/0298/001", | |
"icc": "ICC-A", | |
"insured_name": "Another buyer", | |
"insured_email": "[email protected]", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"COVER ISSUE DATE ": "25-Jan-2018", | |
"IMPORT / EXPORT": "IMPORT", | |
"POLICY NUMBER": "jub/2018/0298", | |
"OPEN COVER (YES or NO)": "YES", | |
"ENDORSEMENT NUMBER": "jub/2018/0298/001", | |
"ICC CLASS (ICC-A, ICC-B or ICC-C)": "ICC-A", | |
"INSURED NAME": "Another buyer", | |
"INSURED EMAIL ADDRESS": "[email protected]", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const selectedGoods = quote.selected_goods; | |
if(this.goodsValidator.allValid()){ | |
this.goodsValidator.hideMessages(); | |
selectedGoods.push(selectedGood); | |
}else { | |
this.goodsValidator.showMessages(); | |
// rerender to show messages for the first time | |
this.forceUpdate(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//async promise with user input | |
const asyncAdd=(a,b)=>{ | |
return new Promise((resolve,reject)=>{ | |
setTimeout(()=>{ | |
if(typeof a=== 'number' && typeof b==='number'){ | |
resolve(a+b); | |
}else { | |
reject('Arguments must be numbers'); | |
} | |
},1500) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
axios.get(geocodeURL).then((response)=>{ | |
if(response.data.status==='ZERO_RESULTS'){ | |
throw new Error('Unable to find that address!'); | |
} | |
const lat=response.data.results[0].geometry.location.lat; | |
const lng=response.data.results[0].geometry.location.lng; | |
const weatherURL=`https://api.darksky.net/forecast/3708bcb6e2a477e7fb94de8fd3ecdfab/${lat},${lng}`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import validator from 'validator'; | |
class FormValidator{ | |
constructor(validations) { | |
// validations is an array of validation rules specific to a form | |
this.validations = validations; | |
} | |
validate(state){ | |
// start out assuming valid | |
let validation = this.valid(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import loading_icon from '../images/ellipsis.gif'; | |
export default class BlankState extends Component { | |
constructor(props){ | |
super(props); | |
let { data = [], dataName = 'Info', isDataLoading, customMessage } = this.props; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loop(arr) { | |
// i IS NOT known here | |
// j IS NOT known here | |
for( var i = 0; i < arr.length; i++ ) { | |
// i IS known here | |
} | |
// i IS known here | |
// j IS NOT known here |