Synchro back-office, fix on tariffs

This commit is contained in:
Ludovic CANDELLIER
2021-10-26 21:41:46 +02:00
parent c150be2c3e
commit 86f6ee9a13
45 changed files with 1095 additions and 406 deletions

View File

@@ -1,5 +1,5 @@
<div class="row">
<div class="col-md-8">
<div class="col-lg-8">
<div class="row mb-3">
<div class="col-3">
@@ -55,7 +55,7 @@
</div>
</div>
<div class="col-md-4">
<div class="col-lg-4">
<div id="product_images_inherited">
@include('Admin.Shop.Articles.partials.product.images')
</div>

View File

@@ -7,7 +7,7 @@
@if ($inherited['tags'])
<h6> Tags</h6>
@foreach ($inherited['tags'] as $tag)
<span class="btn btn-xs">{{ $tag['name'] }}</span>
<button type="button" class="btn btn-secondary btn-xs">{{ $tag['group']['name'] }}-{{ $tag['name'] }}</button>
@endforeach
@endif
@endcomponent

View File

@@ -1,5 +1,5 @@
<div class="row mb-3">
<div class="col-3">
<div class="col-6">
<div class="row mb-3">
<div class="col-12">
{{ Form::label('article_id', 'Article') }}
@@ -20,15 +20,7 @@
@include('components.select', ['name' => 'tariff_id', 'id_name' => 'tariff_id', 'list' => $tariffs ?? null, 'value' => $offer['tariff_id'] ?? null, 'with_empty' => '', 'class' => 'select2 select_tariffs'])
</div>
</div>
</div>
<div class="col-6">
@component('components.card', ['title' => 'Previsualisation'])
<div id="preview-article"></div>
<div id="preview-variation"></div>
<div id="preview-tariff"></div>
@endcomponent
</div>
<div class="col-3">
@component('components.card', ['title' => 'Disponibilité'])
<div class="row mb-3">
<div class="col-12 col-xl-6">
@@ -58,6 +50,14 @@
</div>
@endcomponent
</div>
<div class="col-6">
@component('components.card', ['title' => 'Previsualisation'])
<div id="preview-article"></div>
<div id="preview-variation"></div>
<div id="preview-tariff"></div>
@endcomponent
</div>
</div>
@include('components.save')

View File

@@ -53,56 +53,57 @@
</form>
<script>
function handleAddPrice() {
$('#add_price').click( function () {
var index = $('#prices-table tbody tr').length;
$.get("{{ route('Admin.Shop.PriceListValues.addPrice') }}/" + index, function(data) {
$("#prices-table").append(data);
})
handlePrices();
<script>
function handleAddPrice() {
$('#add_price').click( function () {
var index = $('#prices-table tbody tr').length;
$.get("{{ route('Admin.Shop.PriceListValues.addPrice') }}/" + index, function(data) {
$("#prices-table").append(data);
})
}
function handle_prices() {
$('.price').change(function() {
$col_tax = $(this).parent().parent().find('.tax')();
tax_selected = $col_tax.find('select option:selected').text();
price_taxed = $(this).val() * (1 + (tax_selected / 100));
price_taxed = price_taxed.toFixed(2);
$(this).parent().parent().find('.price_taxed').val(price_taxed);
})
}
function handle_taxes() {
$('.tax').change(function() {
tax_selected = $(this).text();
price = $(this).parent().parent().find('.price').val();
price_taxed = price * (1 + (tax_selected / 100));
price_taxed = price_taxed.toFixed(2);
$(this).parent().parent().find('.price_taxed').val(price_taxed);
})
}
function handle_prices_taxed() {
$('.price_taxed').change(function() {
$col_tax = $(this).parent().parent().find('.tax')();
tax_selected = $col_tax.find('select option:selected').text();
price = $(this).val() / (1 + (tax_selected / 100));
price = price.toFixed(2);
$(this).parent().parent().find('.price').val(price);
})
}
function handlePrices() {
handle_prices();
handle_taxes();
handle_prices_taxed();
}
$(function() {
handleAddPrice();
handlePrices();
});
})
}
</script>
function handle_prices() {
$('.price').change(function() {
$col_tax = $(this).parent().parent().find('.tax');
tax_selected = $col_tax.find('option:selected').text();
price_taxed = $(this).val() * (1 + (tax_selected / 100));
price_taxed = price_taxed.toFixed(2);
console.log(price_taxed);
$(this).parent().parent().find('.price_taxed').val(price_taxed);
})
}
function handle_taxes() {
$('.tax').change(function() {
tax_selected = $(this).find('option:selected').text();
price = $(this).parent().parent().find('.price').val();
price_taxed = price * (1 + (tax_selected / 100));
price_taxed = price_taxed.toFixed(2);
$(this).parent().parent().find('.price_taxed').val(price_taxed);
})
}
function handle_prices_taxed() {
$('.price_taxed').change(function() {
$col_tax = $(this).parent().parent().find('.tax');
tax_selected = $col_tax.find('option:selected').text();
price = $(this).val() / (1 + (tax_selected / 100));
price = price.toFixed(2);
$(this).parent().parent().find('.price').val(price);
})
}
function handlePrices() {
handle_prices();
handle_taxes();
handle_prices_taxed();
}
$(function() {
handleAddPrice();
handlePrices();
});
</script>

View File

@@ -50,7 +50,7 @@
</div>
</div>
<div class="row">
<div class="row mb-3">
<div class="col-12">
@if ($tariff['id'] ?? false)
@@ -70,6 +70,7 @@
@include('components.save')
@include('load.form.editor')
@include('load.form.save')
@include('load.form.select2')
@include('load.layout.modal')
@@ -77,19 +78,21 @@
<script>
$(function() {
initEditor();
initSelect2();
initSaveForm('#tariffs-form');
});
function PriceListCreate() {
var tariff_id = $('#id').val();
var url_open = "{{ route('Admin.Shop.PriceLists.modalCreate') }}/" + tariff_id;
var url_save = "{{ route('Admin.Shop.PriceLists.storeAjax') }}";
openModal("{{ __('price_list') }}", '#price_list-form', url_open, url_save, "PriceListRefresh();");
openModal("{{ __('price_list') }}", '#price_list-form', url_open, url_save, "PriceListRefresh();","extra-large");
}
function PriceListEdit(id) {
var url_open = "{{ route('Admin.Shop.PriceLists.modalEdit') }}/" + id;
var url_save = "{{ route('Admin.Shop.PriceLists.storeAjax') }}";
openModal("{{ __('price_list') }}", '#price_list-form', url_open, url_save, "PriceListRefresh();");
openModal("{{ __('price_list') }}", '#price_list-form', url_open, url_save, "PriceListRefresh();","extra-large");
}
function PriceListRefresh()

View File

@@ -3,8 +3,5 @@
])
@section('content')
@include("Shop.layout.partials.block-breadcrumb")
@include("Shop.layout.partials.category")
@include('Shop.layout.partials.category_articles')
@endsection

View File

@@ -1,57 +0,0 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>OpenSemis</title>
<meta name="description" content="Boutique propulsée par HumaN.E.T">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/vnd.microsoft.icon" href="img/favicon.ico?1528709483">
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico?1528709483">
<link rel="stylesheet" href="/css/theme.css" type="text/css" media="all">
{{ include("Shop._partials.presta_js")}}
</head>
<body id="index" class="lang-fr country-us currency-usd layout-full-width page-index tax-display-disabled">
<main>
{{ include("Shop._partials.header") }}
{{ include("Shop._partials.notifications") }}
<div id="top_home">
<div id="spin-wrapper"></div>
<div id="siteloader">
<div class="loader"></div>
</div>
{{ include("Shop._partials.slider") }}
{{ include("Shop._partials.block-banner") }}
{{ include("Shop._partials.block-products") }}
{{ include("Shop._partials.block-breadcrumb") }}
{{ include("Shop._partials.wrapper") }}
{{ include("Shop._partials.block-bottom")}}
{{ include("Shop._partials.footer")}}
</div>
</main>
<a id="slidetop" href="#" >&nbsp;</a>
<script type="text/javascript" src="/js/theme.js" ></script>
</body>
</html>

View File

@@ -9,13 +9,13 @@
<meta name="robots" content="noindex, nofollow">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>OpenSemis</title>
<title>Jardin'enVie</title>
<meta name="description" content="Vente de semences, variété anciennes">
<meta name="keywords" content="">
<link rel="icon" type="image/vnd.microsoft.icon" href="img/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
<link rel="stylesheet" href="css/site.min.css" type="text/css" media="all">
<link rel="stylesheet" href="/css/site.min.css" type="text/css" media="all">
@stack('css')
@@ -42,7 +42,7 @@
</div>
<script type="text/javascript" src="js/site.min.js" ></script>
<script type="text/javascript" src="/js/site.min.js" ></script>
@stack('scripts')

View File

@@ -1,7 +1,7 @@
<div class="card" style="width: 18rem;">
<img src="{{ App\Repositories\Shop\Articles::getThumbSrc($article['image']) }}" class="card-img-top" alt="...">
<div class="card">
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($offer['article']['image']) }}" class="card-img-top" alt="...">
<div class="card-body">
<span class="card-title">{{ $article['name'] }}</span>
<span class="card-title">{{ $offer['article']['name'] }}</span>
<span class="pull-right">
<i class="fa fa-heart"></i>
</span>

View File

@@ -1,6 +1,6 @@
<div class="row">
@foreach ($articles as $article)
<div class="col-3">
@foreach ($offers as $offer)
<div class="col-sm-6 col-md-3 col-lg-2">
@include('Shop.layout.partials.article')
</div>
@endforeach

View File

@@ -7,15 +7,13 @@
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ $category['name'] }}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
@foreach ($category['children'] as $children)
<a class="dropdown-item" href="{{ $children['id'] }}">{{ $children['name'] }}</a>
@endforeach
</div>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
@include('Shop.layout.partials.submenu', ['categories' => $category['children']])
</ul>
</li>
@else
<li class="nav-item">
<a class="nav-link" href="{{ $category['id'] }}">{{ $category['name'] }}</a>
<a class="nav-link" href="{{ route('Shop.Categories.show', ['id' => $category['id']]) }}">{{ $category['name'] }}</a>
</li>
@endif
@endforeach

View File

@@ -0,0 +1,19 @@
@foreach ($categories as $category)
<li>
@if ($category['children'] ?? false)
<a class="dropdown-item" href="#">
<div class="w-100">
{{ $category['name'] }}
<span style="float: right;">
<i class="fa fa-caret-right"></i>
</span>
</div>
</a>
<ul class="submenu dropdown-menu">
@include('Shop.layout.partials.submenu', ['categories' => $category['children']])
</ul>
@else
<a class="dropdown-item" href="{{ route('Shop.Categories.show', ['id' => $category['id']]) }}">{{ $category['name'] }}</a>
@endif
</li>
@endforeach

View File

@@ -0,0 +1,21 @@
@extends('Shop.layout.layout', [
'title' => __('home.title'),
])
@section('content')
<div class="row">
<div class="col-8">
<h1 style="font-size: 2em;">{{ $category['name'] }}</h1>
<h3 style="font-size: 1.2em;">{!! $category['description'] !!}</h3>
</div>
<div class="col-4">
@include('Shop.layout.partials.category_add')
</div>
</div>
<div class="row">
<div class="col-12">
@include('Shop.layout.partials.category_articles')
</div>
</div>
@endsection