ad detail twig function created && amazon update

This commit is contained in:
vedatakd 2019-10-09 19:01:05 +03:00
parent e8b6218d7f
commit 41fd3d516b
6 changed files with 208 additions and 138 deletions

View File

@ -35,10 +35,15 @@
<div class="row"> <div class="row">
<!-- carousel --> <!-- carousel -->
<div class="col-md-7 slider-box"> <div class="col-md-7 slider-box">
{% if entries('advs').isEnabled('getamazon') %}
{% set product_amazon = entries('getamazon','products').where('slug',adv.slug).first() %}
{% endif %}
{% if blocks('ad-item-picture-block-area') is null %} {% if blocks('ad-item-picture-block-area') is null %}
{% include "visiosoft.module.advs::advs/partials/blocks/ads-item-picture-block" %} {% include "visiosoft.module.advs::advs/partials/blocks/ads-item-picture-block" %}
{% else %} {% else %}
{{ blocks('ad-item-picture-block-area') }} {{ blocks('ad-item-picture-block-area') }}
{% endif %} {% endif %}
</div><!-- Controls --> </div><!-- Controls -->
@ -48,66 +53,12 @@
{% if entries('advs').isEnabled('favs') %} {% if entries('advs').isEnabled('favs') %}
<a class="favorites" href="#"><i id="heart-icon-adv" class="far fa-heart"></i></a> <a class="favorites" href="#"><i id="heart-icon-adv" class="far fa-heart"></i></a>
{% endif %} {% endif %}
<h3 class="title">{{ adv.title }}</h3>
<h2 class="ad-price">
<b>{{ adv.price.format() }}</b> {{ adv.currency }}
{% if app.auth.id == adv.created_by_id %}
<a class="btn btn-info edit-adv-btn" href="/advs/edit_advs/{{ adv.id }}"><i
class="fa fa-pencil-square-o"></i>
<font>{{ trans('visiosoft.module.advs::field.edit') }}</font></a>
{% if adv.status != "pending_admin" and adv.status != "approved" %}
<a class="btn btn-success approve-adv-btn"
href="{{ url_route('visiosoft.module.advs::status',[adv.id,"pending_admin"]) }}"><i
class="fa fa-eye"></i>
<font>{{ trans('visiosoft.module.advs::field.approve') }}</font></a>
{% else %}
<a class="btn btn-danger passive-adv-btn"
href="{{ url_route('visiosoft.module.advs::status',[adv.id,"passive"]) }}"><i
class="fa fa-ban"></i>
<font>{{ trans('visiosoft.module.advs::field.passive') }}</font></a>
{% endif %}
{% endif %}
</h2>
<div class="user-interactions">
{% if adv.is_get_adv == "1" and adv.stock != "0" and entries('advs').isEnabled('carts') %}
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 add-cart-row">
<div class="add-cart-quantity-field">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 add-cart-reduce">
<button type="button" class="btn btn-default btn-number bg-secondary"
data-type="minus"
data-field="quant[1]" disabled="true">
</button>
</div>
<div class="col-lg-4 col-md-4 col-sm-2 col-xs-1 add-cart-quantity">
<input type="text" name="quant[1]" data-id="{{ adv.id }}"
class="form-control add-cart-quantity-input" value="1"
min="1" max="10">
<span>{{ trans('visiosoft.module.advs::field.quantity') }}</span>
{#Trans yapılacak#}
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 add-cart-upgrade">
<button type="button" class="btn btn-default btn-number"
data-type="plus"
data-field="quant[1]" {% if adv.stock < "2" %} disabled="true" {% endif %}>
</button>
</div>
</div>
<div class="add-cart-button-field">
<a class="btn btn-success add-cart-button"
href="{{ url_route('addCart',[adv.id]) }}"><i
class="fa fa-shopping-cart"></i> {{ trans('visiosoft.module.orders::field.addcart') }}
</a>
</div>
</div>
{% endif %}
{% if blocks('ad-item-details-block-area') is null %} {% if blocks('ad-item-details-block-area') is null %}
{% include "visiosoft.module.advs::advs/partials/blocks/ads-item-details-block" %} {% include "visiosoft.module.advs::advs/partials/blocks/ads-item-details-block" %}
{% else %} {% else %}
{{ blocks('ad-item-details-block-area') }} {{ blocks('ad-item-details-block-area') }}
{% endif %} {% endif %}
</div>
</div><!-- slider-text --> </div><!-- slider-text -->
</div> </div>
</div> </div>
@ -125,7 +76,7 @@
{% if blocks('ad-item-content-block-area') is null %} {% if blocks('ad-item-content-block-area') is null %}
{% include "visiosoft.module.advs::advs/partials/blocks/ads-item-content-block" %} {% include "visiosoft.module.advs::advs/partials/blocks/ads-item-content-block" %}
{% else %} {% else %}
{{ blocks('ad-item-content-block-area') }} {{ blocks('ad-item-content-block-area','adasdasda') }}
{% endif %} {% endif %}

View File

@ -1,70 +1,123 @@
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 offered-field offered-row"> <h3 class="title">{{ adv.title }}</h3>
{% if entries('advs').isEnabled('favs') %} <h2 class="ad-price">
<a id="owner-fav" href="#"><i id="heart-icon-seller" class="far fa-heart"></i></a> <b>{{ adv.price.format() }}</b> {{ adv.currency }}
{% if app.auth.id == adv.created_by_id %}
<a class="btn btn-info edit-adv-btn" href="/advs/edit_advs/{{ adv.id }}"><i
class="fa fa-pencil-square-o"></i>
<font>{{ trans('visiosoft.module.advs::field.edit') }}</font></a>
{% if adv.status != "pending_admin" and adv.status != "approved" %}
<a class="btn btn-success approve-adv-btn"
href="{{ url_route('visiosoft.module.advs::status',[adv.id,"pending_admin"]) }}"><i
class="fa fa-eye"></i>
<font>{{ trans('visiosoft.module.advs::field.approve') }}</font></a>
{% else %}
<a class="btn btn-danger passive-adv-btn"
href="{{ url_route('visiosoft.module.advs::status',[adv.id,"passive"]) }}"><i
class="fa fa-ban"></i>
<font>{{ trans('visiosoft.module.advs::field.passive') }}</font></a>
{% endif %}
{% endif %} {% endif %}
<span class="icon">{{ trans('visiosoft.module.advs::field.offered_by') }}: </h2>
<div class="user-interactions">
{% if adv.is_get_adv == "1" and adv.stock != "0" and entries('advs').isEnabled('carts') %}
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 add-cart-row">
<div class="add-cart-quantity-field">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 add-cart-reduce">
<button type="button" class="btn btn-default btn-number bg-secondary"
data-type="minus"
data-field="quant[1]" disabled="true">
</button>
</div>
<div class="col-lg-4 col-md-4 col-sm-2 col-xs-1 add-cart-quantity">
<input type="text" name="quant[1]" data-id="{{ adv.id }}"
class="form-control add-cart-quantity-input" value="1"
min="1" max="10">
<span>{{ trans('visiosoft.module.advs::field.quantity') }}</span>
{#Trans yapılacak#}
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 add-cart-upgrade">
<button type="button" class="btn btn-default btn-number"
data-type="plus"
data-field="quant[1]" {% if adv.stock < "2" %} disabled="true" {% endif %}>
</button>
</div>
</div>
<div class="add-cart-button-field">
<a class="btn btn-success add-cart-button"
href="{{ url_route('addCart',[adv.id]) }}"><i
class="fa fa-shopping-cart"></i> {{ trans('visiosoft.module.orders::field.addcart') }}
</a>
</div>
</div>
{% endif %}
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 offered-field offered-row">
{% if entries('advs').isEnabled('favs') %}
<a id="owner-fav" href="#"><i id="heart-icon-seller" class="far fa-heart"></i></a>
{% endif %}
<span class="icon">{{ trans('visiosoft.module.advs::field.offered_by') }}:
<a id="owner" <a id="owner"
href="{{ url_route('visiosoft.module.advs::list_user_ad', [adv.created_by_id]) }}" href="{{ url_route('visiosoft.module.advs::list_user_ad', [adv.created_by_id]) }}"
data-content="{{ adv.owner_id }}">{{ adv.owner }}</a> data-content="{{ adv.owner_id }}">{{ adv.owner }}</a>
</span> </span>
<span class="icon"> {{ trans('visiosoft.module.advs::field.ad_id') }}: <span class="icon"> {{ trans('visiosoft.module.advs::field.ad_id') }}:
<a href="#" id="adv_id" class="time">{{ adv.id }}</a> <a href="#" id="adv_id" class="time">{{ adv.id }}</a>
</span> </span>
</div> </div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 offered-field offered-row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 offered-field offered-row">
<span class="icon"><i class="far fa-clock"></i><a <span class="icon"><i class="far fa-clock"></i><a
href="#">{{ adv.created_at|date('d/m/Y') }}</a></span> href="#">{{ adv.created_at|date('d/m/Y') }}</a></span>
{% if setting_value('visiosoft.module.location::detail_page_location') %} {% if setting_value('visiosoft.module.location::detail_page_location') %}
<span class="icon"><i class="fa fa-map-marker"></i><a href="#">{{ adv.city_name }} <span class="icon"><i class="fa fa-map-marker"></i><a href="#">{{ adv.city_name }}
, {{ adv.country_name }}</a></span> , {{ adv.country_name }}</a></span>
{% endif %} {% endif %}
{% if adv.isCorporate == 2 %} {% if adv.isCorporate == 2 %}
<span class="icon"><i class="fa fa-suitcase"></i><a <span class="icon"><i class="fa fa-suitcase"></i><a
href="{{ url_route('visiosoft.module.advs::list_user_ad', [adv.created_by_id]) }}">{{ adv.owner }}</a></span> href="{{ url_route('visiosoft.module.advs::list_user_ad', [adv.created_by_id]) }}">{{ adv.owner }}</a></span>
{% endif %} {% endif %}
</div> </div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 offered-field offered-row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 offered-field offered-row">
{% if entries('advs').isEnabled('comparisons') %} {% if entries('advs').isEnabled('comparisons') %}
{% include "visiosoft.module.comparisons::comparebtn" %} {% include "visiosoft.module.comparisons::comparebtn" %}
<span class="icon">{{ trans('visiosoft.module.comparisons::field.comparisonpagetitle') }}</span> <span class="icon">{{ trans('visiosoft.module.comparisons::field.comparisonpagetitle') }}</span>
{% endif %} {% endif %}
</div> </div>
{% if(adv.video_url != null) %} {% if(adv.video_url != null) %}
<div class="contact-with"> <div class="contact-with">
<h4>{{ trans('visiosoft.module.cloudinary::field.video') }}</h4> <h4>{{ trans('visiosoft.module.cloudinary::field.video') }}</h4>
<a class="btn btn-success" onclick="openVideo()"><i class="fa fa-file-video-o" <a class="btn btn-success" onclick="openVideo()"><i class="fa fa-file-video-o"
aria-hidden="true"></i> {{ trans('visiosoft.module.cloudinary::field.video') }} aria-hidden="true"></i> {{ trans('visiosoft.module.cloudinary::field.video') }}
</a> </a>
<div class="modal fade" id="adv-video" tabindex="-1" role="dialog" <div class="modal fade" id="adv-video" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel"> aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="close-modal text-right"> <div class="close-modal text-right">
<button type="button" class="btn btn-danger" data-dismiss="modal">X <button type="button" class="btn btn-danger" data-dismiss="modal">X
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<video controls loop class="img-responsive" <video controls loop class="img-responsive"
style="text-align: center; width: 100%"> style="text-align: center; width: 100%">
<source src="{{ adv.video_url }}" class="video-src" <source src="{{ adv.video_url }}" class="video-src"
type="video/mp4"/> type="video/mp4"/>
</video> </video>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> {% endif %}
{% endif %} {% if(profile.getObject().gsm_phone is not null or profile.office_phone is not null or entries('advs').isEnabled('messages')) %}
{% if(profile.getObject().gsm_phone is not null or profile.office_phone is not null or entries('advs').isEnabled('messages')) %} <!-- contact-with -->
<!-- contact-with --> <div class="contact-with">
<div class="contact-with"> <h4> {{ trans('visiosoft.module.advs::field.contact_with') }}</h4>
<h4> {{ trans('visiosoft.module.advs::field.contact_with') }}</h4> {% if(profile.getObject().gsm_phone != null) %}
{% if(profile.getObject().gsm_phone != null) %} <span class="btn btn-red show-number" data-id="{{ adv.id }}">
<span class="btn btn-red show-number" data-id="{{ adv.id }}">
<i class="fa fa-phone-square"></i> <i class="fa fa-phone-square"></i>
<span class="hide-text">{{ trans('visiosoft.module.advs::field.click_phone') }} </span> <span class="hide-text">{{ trans('visiosoft.module.advs::field.click_phone') }} </span>
<span class="hide-number">{{ trans("visiosoft.module.advs::field.phone_gsm") }} <span class="hide-number">{{ trans("visiosoft.module.advs::field.phone_gsm") }}
@ -75,34 +128,35 @@
{% endif %} {% endif %}
</span> </span>
</span> </span>
{% endif %} {% endif %}
{% if entries('advs').isEnabled('messages') %} {% if entries('advs').isEnabled('messages') %}
<a data-content="{{ app.auth.id }}" id="message" class="btn"><i <a data-content="{{ app.auth.id }}" id="message" class="btn"><i
class="fa fa-envelope-square"></i>{{ trans("visiosoft.module.advs::field.send_message") }} class="fa fa-envelope-square"></i>{{ trans("visiosoft.module.advs::field.send_message") }}
</a> </a>
{% endif %} {% endif %}
</div><!-- contact-with --> </div><!-- contact-with -->
{% endif %} {% endif %}
{% if adv_detail_place_code %} {% if adv_detail_place_code %}
<div> <div>
{{ adv_detail_place_code }} {{ adv_detail_place_code }}
</div> </div>
{% endif %} {% endif %}
<!-- social-links --> <!-- social-links -->
<div class="social-links"> <div class="social-links">
<h4>{{ trans('visiosoft.module.advs::field.share') }}</h4> <h4>{{ trans('visiosoft.module.advs::field.share') }}</h4>
<ul class="list-inline"> <ul class="list-inline">
<li><a target="_blank" <li><a target="_blank"
href="https://www.facebook.com/sharer/sharer.php?u={{ app.request.uri }}"><i href="https://www.facebook.com/sharer/sharer.php?u={{ app.request.uri }}"><i
class="fab fa-facebook-square"></i></a></li> class="fab fa-facebook-square"></i></a></li>
<li><a target="_blank" <li><a target="_blank"
href="https://twitter.com/intent/tweet?text={{ app.request.uri }}"><i href="https://twitter.com/intent/tweet?text={{ app.request.uri }}"><i
class="fab fa-twitter-square"></i></a></li> class="fab fa-twitter-square"></i></a></li>
<li><a target="_blank" href="https://wa.me/?text={{ app.request.uri }}"><i <li><a target="_blank" href="https://wa.me/?text={{ app.request.uri }}"><i
class="fab fa-whatsapp"></i></a></li> class="fab fa-whatsapp"></i></a></li>
<li><a target="_blank" <li><a target="_blank"
href="https://www.linkedin.com/shareArticle?mini=true&url={{ app.request.uri }}"><i href="https://www.linkedin.com/shareArticle?mini=true&url={{ app.request.uri }}"><i
class="fab fa-linkedin"></i></a></li> class="fab fa-linkedin"></i></a></li>
</ul> </ul>
</div>
<!-- social-links -->
</div> </div>
<!-- social-links -->

View File

@ -0,0 +1,34 @@
<?php namespace Visiosoft\AdvsModule\Adv\Command;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
class GetAd
{
/**
* @var $id
*/
protected $id;
/**
* GetProduct constructor.
* @param $id
*/
public function __construct($id)
{
$this->id = $id;
}
/**
* @param AdvRepositoryInterface $groups
* @return |null
*/
public function handle(AdvRepositoryInterface $groups)
{
if ($this->id) {
return $groups->findById($this->id);
}
return null;
}
}

View File

@ -0,0 +1,28 @@
<?php namespace Visiosoft\AdvsModule;
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
use Visiosoft\AdvsModule\Adv\Command\GetAd;
class AdvsModulePlugin extends Plugin
{
/**
* @return array
*/
public function getFunctions()
{
return [
new \Twig_SimpleFunction(
'adDetail',
function ($id) {
if (!$ad = $this->dispatch(new GetAd($id))) {
return null;
}
return $ad;
}
)
];
}
}

View File

@ -27,7 +27,9 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
* *
* @type array|null * @type array|null
*/ */
protected $plugins = []; protected $plugins = [
AdvsModulePlugin::class,
];
/** /**
* The addon Artisan commands. * The addon Artisan commands.

View File

@ -67,7 +67,8 @@
"anomaly/html_block-extension": "~1.0.0", "anomaly/html_block-extension": "~1.0.0",
"anomaly/wysiwyg_block-extension": "~1.0.0", "anomaly/wysiwyg_block-extension": "~1.0.0",
"ammadeuss/laravel-html-dom-parser": "^1.1", "ammadeuss/laravel-html-dom-parser": "^1.1",
"guzzlehttp/guzzle": "~6.3.3" "guzzlehttp/guzzle": "~6.3.3",
"paquettg/php-html-parser": "^2.1"
}, },
"require-dev": { "require-dev": {
"filp/whoops": "~2.0", "filp/whoops": "~2.0",