mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#1614 [core-sahibinden-dress] Etiket Fiyatı Liste Fiyatı ve yüzdelik indirim hesaplaması
This commit is contained in:
parent
745cf0d62e
commit
0a576dabe9
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
||||
|
||||
class VisiosoftModuleAdvsCreateStandardPriceField extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Don't delete stream on rollback
|
||||
* because this isn't creating the
|
||||
* stream only referencing it.
|
||||
*/
|
||||
protected $delete = false;
|
||||
|
||||
/**
|
||||
* Any additional information will
|
||||
* be updated. Slug helps find
|
||||
* the stream to work with for
|
||||
* assignments that follow.
|
||||
*/
|
||||
protected $stream = [
|
||||
'slug' => 'advs',
|
||||
];
|
||||
|
||||
/**
|
||||
* The addon fields.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fields = [
|
||||
'standard_price' => [
|
||||
'type' => 'visiosoft.field_type.decimal',
|
||||
'config' => [
|
||||
'decimal' => 2,
|
||||
'separator' => '.',
|
||||
'point' => ','
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The field's assignment.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $assignments = [
|
||||
'standard_price' => [
|
||||
'required' => true
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
@ -3,6 +3,16 @@
|
||||
border-color: #ffc107 #ffc107 #ffc107;
|
||||
}
|
||||
|
||||
.ad-price-standard {
|
||||
color: #f00;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.ad-price-standard-percentage {
|
||||
background-color: #f00;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* Pending screen */
|
||||
.pending-screen {
|
||||
background-color: #f2f2f2;
|
||||
@ -13,4 +23,4 @@
|
||||
}
|
||||
.pending-screen p {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".priceField").inputmask('currency', {
|
||||
$(".priceField, .standard-price-field").inputmask('currency', {
|
||||
rightAlign: true,
|
||||
prefix: "",
|
||||
'groupSeparator': '.',
|
||||
@ -200,7 +200,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(".priceDecimalField").inputmask('99', {
|
||||
$(".priceDecimalField, .standard-price-decimal-field").inputmask('99', {
|
||||
rightAlign: true,
|
||||
prefix: "",
|
||||
autoUnmask: true,
|
||||
@ -210,11 +210,15 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(".priceField, .priceDecimalField").on('change', function () {
|
||||
$(".priceField, .priceDecimalField, .standard-price-field, .standard-price-decimal-field").on('change', function () {
|
||||
let price = $(".priceField").val() === "" ? '0' : $(".priceField").val();
|
||||
let standardPrice = $(".standard-price-field").val() === "" ? '0' : $(".standard-price-field").val();
|
||||
price = parseInt(price.replace(/\./g, ''));
|
||||
standardPrice = parseInt(standardPrice.replace(/\./g, ''));
|
||||
let decimal = parseInt($(".priceDecimalField").val());
|
||||
let standardDecimal = parseInt($(".standard-price-decimal-field").val());
|
||||
$('.priceHidden').find('input').val(parseFloat(price + "." + decimal));
|
||||
$('.standard-price-hidden').find('input').val(parseFloat(standardPrice + "." + standardDecimal));
|
||||
});
|
||||
|
||||
// Add dynamic option creation
|
||||
|
||||
@ -19,6 +19,9 @@ return [
|
||||
'price' => [
|
||||
'name' => 'Price'
|
||||
],
|
||||
'standard_price' => [
|
||||
'name' => 'Standard Price'
|
||||
],
|
||||
'date' => [
|
||||
'name' => 'Date'
|
||||
],
|
||||
|
||||
@ -4,6 +4,10 @@
|
||||
{% include "visiosoft.module.advs::ad-detail/partials/ogdata" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
{{ asset_style("visiosoft.module.advs::css/detail.css") }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section id="main" class="clearfix details-page">
|
||||
<div class="container">
|
||||
@ -52,6 +56,5 @@
|
||||
</section>
|
||||
|
||||
{{ asset_add("scripts.js", "visiosoft.module.advs::js/viewed.js") }}
|
||||
{{ asset_add("styles.css", "visiosoft.module.advs::css/detail.css") }}
|
||||
|
||||
{% endblock %}
|
||||
@ -1,5 +1,16 @@
|
||||
<div class="slider-text">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 offered-field offered-row">
|
||||
{% set standardPrice = adv.standard_price.value %}
|
||||
{% if standardPrice %}
|
||||
<div class="d-flex flex-wrap align-items-center">
|
||||
<h3 class="ad-price-standard mr-3 text-truncate">
|
||||
<b>{{ adv.standard_price.currency(null,'currency') }}</b>
|
||||
</h3>
|
||||
<h3 class="ad-price-standard-percentage text-white p-2">
|
||||
<b>%{{ (100 - ((100 * adv.price.value) / adv.standard_price.value))|round(0, 'common') }}</b>
|
||||
</h3>
|
||||
</div>
|
||||
{% endif %}
|
||||
<h3 class="ad-price">
|
||||
<b>{{ adv.price.currency(null,'currency') }}</b>
|
||||
<!-- priceField with Block -->
|
||||
|
||||
@ -59,6 +59,27 @@
|
||||
</div>
|
||||
</div>
|
||||
{{ addBlock('new-ad/fields',{'adv':adv})|raw }}
|
||||
|
||||
<div class="row form-group select-price">
|
||||
<label class="col-sm-2 col-xs-12">
|
||||
{{ form.fields.standard_price.label|raw }}
|
||||
<span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-12 standard-price-hidden d-none">
|
||||
{{ form.fields.standard_price.setAttributes({
|
||||
'required' :true
|
||||
}).input|raw }}
|
||||
</div>
|
||||
{% set standardPriceValue = form.fields.standard_price.value|split('.') %}
|
||||
<div class="col-8 pr-0 col-md-3">
|
||||
<input class="form-control standard-price-field" value="{{ standardPriceValue|first }}">
|
||||
</div>
|
||||
<div class="col-4 col-md-1">
|
||||
<input class="form-control standard-price-decimal-field" placeholder="00" maxlength="2"
|
||||
value="{{ standardPriceValue[1] }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group select-price">
|
||||
<label class="col-sm-2 col-xs-12">
|
||||
{{ form.fields.price.label|raw }}
|
||||
|
||||
@ -22,6 +22,9 @@ class AdvFormBuilder extends FormBuilder
|
||||
'price' => [
|
||||
'type' => 'anomaly.field_type.text'
|
||||
],
|
||||
'standard_price' => [
|
||||
'type' => 'anomaly.field_type.text'
|
||||
],
|
||||
'advs_desc',
|
||||
'cat1',
|
||||
'cat2',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user