myAds price currency format edited

This commit is contained in:
Muammer Top 2020-11-12 13:09:51 +03:00
parent 5d4e8ca9f4
commit 0dd3934aeb
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,7 @@
<?php namespace Visiosoft\AdvsModule\Http\Controller;
use Anomaly\Streams\Platform\Http\Controller\PublicController;
use Anomaly\Streams\Platform\Support\Currency;
use Anomaly\UsersModule\User\UserModel;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Illuminate\Http\Request;
@ -81,6 +82,7 @@ class AjaxController extends PublicController
foreach ($my_advs as $index => $ad) {
$my_advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');
$my_advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad);
$my_advs[$index]->formatted_price = app(Currency::class)->format($ad->price, $ad->currency);
}
return response()->json(['success' => true, 'content' => $my_advs, 'title' => $page_title]);

View File

@ -37,8 +37,8 @@ function changePage(page) {
}
for (var i = (page - 1) * records_per_page; i < (page * records_per_page) && i < objJson.length; i++) {
listing_table.append(addAdsRow(objJson[i].id, objJson[i].detail_url, objJson[i].cover_photo, objJson[i].name,
objJson[i].price + " " + objJson[i].currency,
objJson[i].city_name, objJson[i].country_name, objJson[i].cat1_name, objJson[i].cat2_name, objJson[i].status));
objJson[i].formatted_price, objJson[i].city_name, objJson[i].country_name, objJson[i].cat1_name,
objJson[i].cat2_name, objJson[i].status));
}
page_span.html(page + "/" + numPages());
@ -97,7 +97,7 @@ type = type ? type : 'approved';
getMyAdvs(type);
function addAdsRow(id, href, image, name, price, city, country, cat1, cat2, status) {
function addAdsRow(id, href, image, name, formatted_price, city, country, cat1, cat2, status) {
return "<div class='col-md-12 mb-2 profile-ads border-bottom border-white'>\n" +
"<div class='row bg-light'>\n" +
"<div class='col-md-2 justify-content-center align-self-center border-right border-white'>\n" +
@ -120,7 +120,7 @@ function addAdsRow(id, href, image, name, price, city, country, cat1, cat2, stat
"<div class='col-md-3 text-left justify-content-center align-self-center'>\n" +
"<div class='row'>\n" +
"<div class='col-md-12'>\n" +
"<b>" + price + "</b>\n" +
"<b>" + formatted_price + "</b>\n" +
"</div>\n" +
"<div class='col-md-12 justify-content-center align-self-center text-truncate'>\n" +
"<small>" + city + " " + country + "</small>\n" +