Skip to content
Snippets Groups Projects
Commit 60887ff1 authored by Nigel  Sahl's avatar Nigel Sahl
Browse files

update: seperate format card

parent b9bafb26
No related merge requests found
...@@ -91,6 +91,7 @@ $selectedSorting = $_GET["sorting"] ?? null; ...@@ -91,6 +91,7 @@ $selectedSorting = $_GET["sorting"] ?? null;
</div> </div>
</div> </div>
<script src="/public/javascript/gym/format_card.js"></script>
<script src="/public/javascript/gym/gym_card.js"></script> <script src="/public/javascript/gym/gym_card.js"></script>
<script src="/public/javascript/pagination.js"></script> <script src="/public/javascript/pagination.js"></script>
<script src="/public/javascript/gym/filter.js"></script> <script src="/public/javascript/gym/filter.js"></script>
......
function truncateText(text, length)
{
if (text.length <= length) {
return text;
} else {
text = text.substring(0, length-3);
text = text + "...";
return text;
}
}
function formatPrice(price)
{
if (price == 0) {
return "Free";
}
price = price.toLocaleString('id-ID');
return 'Rp' + price;
}
\ No newline at end of file
function truncateText(text, length)
{
if (text.length <= length) {
return text;
} else {
text = text.substring(0, length-3);
text = text + "...";
return text;
}
}
function formatPrice(price)
{
if (price == 0) {
return "Free";
}
price = price.toLocaleString('id-ID');
return 'Rp' + price;
}
function GymCard(gym){ function GymCard(gym){
let truncated_name = truncateText(gym.name, 16); let truncated_name = truncateText(gym.name, 16);
let formatted_price = formatPrice(gym.monthly_price); let formatted_price = formatPrice(gym.monthly_price);
...@@ -41,4 +21,4 @@ function GymCard(gym){ ...@@ -41,4 +21,4 @@ function GymCard(gym){
</a> </a>
`; `;
return gym_card; return gym_card;
} }
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment