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={ | |
variants: [ | |
{ | |
id: 'ae020c58-5d83-4665-9e5f-af3f21f80371', | |
product: '800402fc-b0cb-4bbe-8380-3bcee92f3bf9', | |
category_type: 'productvariants', | |
products_metadata: {}, | |
thumbnail: null, | |
thumbnail_frontend: null, | |
quantity: 1, |
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
//Data | |
[ | |
{ | |
"product_ids": [ | |
"e331e78b-e954-4de3-9bb3-80827b0d0741" | |
], | |
"body": { | |
"command": "request", | |
"data": { | |
"api_key": "errtrt4i548", |
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
Redux is a state container to keep your state in one place...single source of truth. | |
But initially, youd don't need redux until your app grows and you can't track tell the source of the props in some of the components. | |
we have components for a name input, a name list, and after the name list generates the pairs which are then displayed in the pairs container. | |
But here’s the problem(s): | |
-[X] How does NameInput send the name into the NameList? | |
-[X] How does NameList have access to the names? | |
-[X] How does PairContainer know what the pairs are? |
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 variants=[ | |
{"id":1,"name":"shoes","color":"red"}, | |
{"id":2,"name":"food","color":"blue"}, | |
{"id":3,"name":"car","color":"yellow"}, | |
]; | |
// I want to extract the keys and values from this data and create a new array which looks like: | |
// newAyy=[ | |
// {id:["1","2","3"]}, | |
// {name:["shoes","food","car"]}, |
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
export const getUserRole = () => { | |
const storage = getItemFromStorage(KEY); | |
const user_roles = { | |
roles: '' | |
}; | |
if (!storage) { | |
user_roles.roles = null; | |
} | |
for (const key in user_roles) { | |
user_roles.roles = storage.currentUser.user_roles; |
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
var test = [ | |
{ | |
date_issued: '2018-05-25', | |
transaction_type: 'IMPORT', | |
policy_number: '061/100/001052/2018', | |
open_cover: false, | |
endorsement_number: '', | |
icc: 'ICC-A', | |
insured_name: 'SAYONA STEEL LTD', | |
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
var test = [ | |
{ | |
date_issued: '2018-05-25', | |
transaction_type: 'IMPORT', | |
policy_number: '061/100/001052/2018', | |
open_cover: false, | |
endorsement_number: '', | |
icc: 'ICC-A', | |
insured_name: 'SAYONA STEEL LTD', | |
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
<?php | |
// example code | |
$input = array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5); | |
$output = array_slice($input, 0, 4,true); // returns "a", "b", and "c" | |
print_r($output); |
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
<div className="card clearfix"> | |
{filteredInsurers.length > 0 ? ( | |
<DataTable | |
tableId="quotes-table" | |
columnTitles={['Provider', 'Premium ', 'Rate', '']} | |
> | |
{filteredInsurers.map((insurer, index) => { | |
return insurer.insurer !== null ? ( | |
<tr key={index}> | |
<td> |
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 getInsurerValue = (insurer, conveyance, packaging, icc) => { | |
var value = 0; | |
var is_containerised = packaging === 'CONTAINERISED'; | |
if (icc === 'ICC-A') { | |
if (conveyance === Config.CONVEYANCE.AIR) { | |
value = insurer.icc_a.air_value; | |
} else if (conveyance === Config.CONVEYANCE.SEA && is_containerised) { | |
value = insurer.icc_a.sea_containerised_value; | |
} else if (conveyance === Config.CONVEYANCE.SEA && !is_containerised) { | |
value = insurer.icc_a.sea_non_containerised_value; |