fix name of country
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 10s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 10s
This commit is contained in:
@@ -32,6 +32,7 @@ class ProductsCompareController extends Controller
|
|||||||
$countries = [];
|
$countries = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cHash = CountryCode::code_countryHash();
|
||||||
if (is_array($codes) == false)
|
if (is_array($codes) == false)
|
||||||
$aCodes = [$codes['code']];
|
$aCodes = [$codes['code']];
|
||||||
else
|
else
|
||||||
@@ -51,7 +52,8 @@ class ProductsCompareController extends Controller
|
|||||||
});
|
});
|
||||||
Log::info("{products}", ["products" => $products]);
|
Log::info("{products}", ["products" => $products]);
|
||||||
return Inertia::render('IkeaRoot', [
|
return Inertia::render('IkeaRoot', [
|
||||||
'products' => $products
|
'products' => $products,
|
||||||
|
'countryHash' => $cHash,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,15 @@ class CountryCode extends Model
|
|||||||
$codes = $this->select('country_name', 'country_code')->get();
|
$codes = $this->select('country_name', 'country_code')->get();
|
||||||
return $codes->mapWithKeys(function ($item) {
|
return $codes->mapWithKeys(function ($item) {
|
||||||
return [$item['country_name'] => $item['country_code']];
|
return [$item['country_name'] => $item['country_code']];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function code_countryHash()
|
||||||
|
{
|
||||||
|
$codes = $this->select('country_name', 'country_code')->get();
|
||||||
|
return $codes->mapWithKeys(function ($item) {
|
||||||
|
return [$item['country_code'] => $item['country_name']];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,17 @@ const props = defineProps({
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: []
|
default: []
|
||||||
},
|
},
|
||||||
|
countryHash: {
|
||||||
|
type: Object,
|
||||||
|
default: []
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log(props.countryHash);
|
||||||
let tproducts = computed(() => {
|
let tproducts = computed(() => {
|
||||||
return props.products.map((prod) => {
|
return props.products.map((prod) => {
|
||||||
prod.salesPrice = parseFloat(prod.salesPrice);
|
prod.salesPrice = parseFloat(prod.salesPrice);
|
||||||
|
prod.country = props.countryHash[prod.country];
|
||||||
return prod;
|
return prod;
|
||||||
} )
|
} )
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user