Merge branch 'master' of https://github.com/bagisto/bagisto into development

This commit is contained in:
rahul shukla 2021-01-13 12:35:35 +05:30
commit c4c871342e
18 changed files with 160 additions and 1510 deletions

View File

@ -33,6 +33,7 @@
"intervention/image": "^2.4",
"intervention/imagecache": "^2.3",
"kalnoy/nestedset": "5.0.1",
"khaled.alshamaa/ar-php": "^5.5",
"konekt/concord": "^1.2",
"laravel/framework": "^7.0",
"laravel/scout": "^8.0",

1522
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,10 @@ class AttributeDataGrid extends DataGrid
->select('id')
->addSelect('id', 'code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel');
$this->addFilter('is_unique', 'is_unique');
$this->addFilter('value_per_locale', 'value_per_locale');
$this->addFilter('value_per_channel', 'value_per_channel');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -62,6 +62,8 @@ class CartRuleDataGrid extends DataGrid
$queryBuilder->where('cart_rule_channels.channel_id', $this->channel);
}
$this->addFilter('status', 'status');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -16,6 +16,9 @@ class CatalogRuleDataGrid extends DataGrid
$queryBuilder = DB::table('catalog_rules')
->addSelect('catalog_rules.id', 'name', 'status', 'starts_from', 'ends_till', 'sort_order');
$this->addFilter('status', 'status');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -24,6 +24,7 @@ class CategoryDataGrid extends DataGrid
->groupBy('cat.id');
$this->addFilter('status', 'cat.status');
$this->addFilter('category_id', 'cat.id');
$this->setQueryBuilder($queryBuilder);

View File

@ -24,6 +24,7 @@ class CustomerDataGrid extends DataGrid
$this->addFilter('full_name', DB::raw('CONCAT(' . DB::getTablePrefix() . 'customers.first_name, " ", ' . DB::getTablePrefix() . 'customers.last_name)'));
$this->addFilter('phone', 'customers.phone');
$this->addFilter('gender', 'customers.gender');
$this->addFilter('status', 'status');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -15,6 +15,8 @@ class EmailTemplateDataGrid extends DataGrid
{
$queryBuilder = DB::table('marketing_templates')->addSelect('id', 'name', 'status');
$this->addFilter('status', 'status');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -15,6 +15,8 @@ class InventorySourcesDataGrid extends DataGrid
{
$queryBuilder = DB::table('inventory_sources')->addSelect('id', 'code', 'name', 'priority', 'status');
$this->addFilter('status', 'status');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -20,6 +20,7 @@ class UserDataGrid extends DataGrid
$this->addFilter('user_id', 'u.id');
$this->addFilter('user_name', 'u.name');
$this->addFilter('role_name', 'ro.name');
$this->addFilter('status', 'u.status');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -2,10 +2,10 @@
namespace Webkul\Admin\Http\Controllers\Sales;
use PDF;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Sales\Repositories\InvoiceRepository;
use PDF;
class InvoiceController extends Controller
{
@ -141,8 +141,30 @@ class InvoiceController extends Controller
{
$invoice = $this->invoiceRepository->findOrFail($id);
$pdf = PDF::loadView('admin::sales.invoices.pdf', compact('invoice'))->setPaper('a4');
$html = view('admin::sales.invoices.pdf', compact('invoice'))->render();
return $pdf->download('invoice-' . $invoice->created_at->format('d-m-Y') . '.pdf');
return PDF::loadHTML($this->adjustArabicAndPersianContent($html))
->setPaper('a4')
->download('invoice-' . $invoice->created_at->format('d-m-Y') . '.pdf');
}
/**
* Adjust arabic and persian content.
*
* @param string $html
* @return string
*/
private function adjustArabicAndPersianContent($html)
{
$arabic = new \ArPHP\I18N\Arabic();
$p = $arabic->arIdentify($html);
for ($i = count($p)-1; $i >= 0; $i -= 2) {
$utf8ar = $arabic->utf8Glyphs(substr($html, $p[$i-1], $p[$i] - $p[$i-1]));
$html = substr_replace($html, $utf8ar, $p[$i-1], $p[$i] - $p[$i-1]);
}
return $html;
}
}

View File

@ -260,11 +260,11 @@
</div>
@endif
</td>
<td>{{ core()->formatBasePrice($item->base_price) }}</td>
<td>{!! core()->formatBasePrice($item->base_price, true) !!}</td>
<td class="text-center">{{ $item->qty }}</td>
<td class="text-center">{{ core()->formatBasePrice($item->base_total) }}</td>
<td class="text-center">{{ core()->formatBasePrice($item->base_tax_amount) }}</td>
<td class="text-center">{{ core()->formatBasePrice($item->base_total + $item->base_tax_amount) }}</td>
<td class="text-center">{!! core()->formatBasePrice($item->base_total, true) !!}</td>
<td class="text-center">{!! core()->formatBasePrice($item->base_tax_amount, true) !!}</td>
<td class="text-center">{!! core()->formatBasePrice($item->base_total + $item->base_tax_amount, true) !!}</td>
</tr>
@endforeach
@ -277,31 +277,31 @@
<tr>
<td>{{ __('admin::app.sales.orders.subtotal') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($invoice->base_sub_total) }}</td>
<td>{!! core()->formatBasePrice($invoice->base_sub_total, true) !!}</td>
</tr>
<tr>
<td>{{ __('admin::app.sales.orders.shipping-handling') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($invoice->base_shipping_amount) }}</td>
<td>{!! core()->formatBasePrice($invoice->base_shipping_amount, true) !!}</td>
</tr>
<tr>
<td>{{ __('admin::app.sales.orders.tax') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($invoice->base_tax_amount) }}</td>
<td>{!! core()->formatBasePrice($invoice->base_tax_amount, true) !!}</td>
</tr>
<tr>
<td>{{ __('admin::app.sales.orders.discount') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($invoice->base_discount_amount) }}</td>
<td>{!! core()->formatBasePrice($invoice->base_discount_amount, true) !!}</td>
</tr>
<tr>
<td><strong>{{ __('admin::app.sales.orders.grand-total') }}</strong></td>
<td><strong>-</strong></td>
<td><strong>{{ core()->formatBasePrice($invoice->base_grand_total) }}</strong></td>
<td><strong>{!! core()->formatBasePrice($invoice->base_grand_total, true) !!}</strong></td>
</tr>
</table>

View File

@ -61,7 +61,7 @@
{{ __('admin::app.settings.channels.name') }}
<span class="locale">[{{ $locale }}]</span>
</label>
<input v-validate="'required'" class="control" id="name" name="{{$locale}}[name]" data-vv-as="&quot;{{ __('admin::app.settings.channels.name') }}&quot;" value="{{ old($locale)['name'] ?? ($channel->translate($locale)['name'] ?? '') }}"/>
<input v-validate="'required'" class="control" id="name" name="{{$locale}}[name]" data-vv-as="&quot;{{ __('admin::app.settings.channels.name') }}&quot;" value="{{ old($locale)['name'] ?? ($channel->translate($locale)['name'] ?? $channel->name) }}"/>
<span class="control-error" v-if="errors.has('{{$locale}}[name]')">@{{ errors.first('{!!$locale!!}[page_title]') }}</span>
</div>
@ -70,7 +70,7 @@
{{ __('admin::app.settings.channels.description') }}
<span class="locale">[{{ $locale }}]</span>
</label>
<textarea class="control" id="description" name="{{$locale}}[description]">{{ old($locale)['description'] ?? ($channel->translate($locale)['description'] ?? '') }}</textarea>
<textarea class="control" id="description" name="{{$locale}}[description]">{{ old($locale)['description'] ?? ($channel->translate($locale)['description'] ?? $channel->description) }}</textarea>
</div>
<div class="control-group" :class="[errors.has('inventory_sources[]') ? 'has-error' : '']">
@ -190,7 +190,7 @@
{{ __('admin::app.settings.channels.home_page_content') }}
<span class="locale">[{{ $locale }}]</span>
</label>
<textarea class="control" id="home_page_content" name="{{$locale}}[home_page_content]">{{ old($locale)['home_page_content'] ?? ($channel->translate($locale)['home_page_content'] ?? '') }}</textarea>
<textarea class="control" id="home_page_content" name="{{$locale}}[home_page_content]">{{ old($locale)['home_page_content'] ?? ($channel->translate($locale)['home_page_content'] ?? $channel->home_page_content) }}</textarea>
</div>
<div class="control-group">
@ -198,7 +198,7 @@
{{ __('admin::app.settings.channels.footer_content') }}
<span class="locale">[{{ $locale }}]</span>
</label>
<textarea class="control" id="footer_content" name="{{$locale}}[footer_content]">{{ old($locale)['footer_content'] ?? ($channel->translate($locale)['footer_content'] ?? '') }}</textarea>
<textarea class="control" id="footer_content" name="{{$locale}}[footer_content]">{{ old($locale)['footer_content'] ?? ($channel->translate($locale)['footer_content'] ?? $channel->footer_content) }}</textarea>
</div>
<div class="control-group">
@ -217,7 +217,7 @@
</accordian>
@php
$home_seo = $channel->translate($locale)['home_seo'] ?? '{}';
$home_seo = $channel->translate($locale)['home_seo'] ?? $channel->home_seo;
$seo = json_decode($home_seo);
@endphp
@ -276,7 +276,7 @@
{{ __('admin::app.settings.channels.maintenance-mode-text') }}
<span class="locale">[{{ $locale }}]</span>
</label>
<input class="control" id="maintenance-mode-text" name="{{$locale}}[maintenance_mode_text]" value="{{ old('maintenance_mode_text') ?? ($channel->translate($locale)['maintenance_mode_text'] ?? '') }}"/>
<input class="control" id="maintenance-mode-text" name="{{$locale}}[maintenance_mode_text]" value="{{ old('maintenance_mode_text') ?? ($channel->translate($locale)['maintenance_mode_text'] ?? $channel->maintenance_mode_text) }}"/>
</div>
<div class="control-group">

View File

@ -554,13 +554,15 @@ class Core
}
/**
* Format price with base currency symbol
* Format price with base currency symbol. This method also give ability to encode
* the base currency symbol and its optional.
*
* @param float $price
* @param float $price
* @param bool $isEncoded
*
* @return string
*/
public function formatBasePrice($price)
public function formatBasePrice($price, $isEncoded = false)
{
if (is_null($price)) {
$price = 0;
@ -570,15 +572,17 @@ class Core
if ($symbol = $this->getBaseCurrency()->symbol) {
if ($this->currencySymbol($this->getBaseCurrencyCode()) == $symbol) {
return $formater->formatCurrency($price, $this->getBaseCurrencyCode());
$content = $formater->formatCurrency($price, $this->getBaseCurrencyCode());
} else {
$formater->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $symbol);
return $formater->format($this->convertPrice($price));
$content = $formater->format($this->convertPrice($price));
}
} else {
return $formater->formatCurrency($price, $this->getBaseCurrencyCode());
$content = $formater->formatCurrency($price, $this->getBaseCurrencyCode());
}
return ! $isEncoded ? $content : htmlentities($content);
}
/**

View File

@ -40,7 +40,13 @@
@section('content-wrapper')
{!! view_render_event('bagisto.shop.home.content.before') !!}
{!! DbView::make($channel)->field('home_page_content')->with(['sliderData' => $sliderData])->render() !!}
@if (! is_null($channel->home_page_content))
{!! DbView::make($channel)->field('home_page_content')->with(['sliderData' => $sliderData])->render() !!}
@else
@include('shop::home.slider', ['sliderData' => $sliderData])
@include('shop::home.featured-products')
@include('shop::home.new-products')
@endif
{{ view_render_event('bagisto.shop.home.content.after') }}

View File

@ -22,6 +22,7 @@ class ContentDataGrid extends DataGrid
->groupBy('con.id');
$this->addFilter('content_id', 'con.id');
$this->addFilter('status', 'con.status');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -132,8 +132,8 @@
new_shipping_address: false,
selected_payment_method: '',
selected_shipping_method: '',
country: @json(core()->countries()),
countryStates: @json(core()->groupedStatesByCountries()),
countries: [],
countryStates: [],
step_numbers: {
'information': 1,
@ -157,6 +157,10 @@
},
created: function () {
this.fetchCountries();
this.fetchCountryStates();
this.getOrderSummary();
if (! customerAddress) {
@ -173,11 +177,11 @@
} else {
this.allAddress = customerAddress;
for (var country in this.country) {
for (var code in this.allAddress) {
for (let country in this.countries) {
for (let code in this.allAddress) {
if (this.allAddress[code].country) {
if (this.allAddress[code].country == this.country[country].code) {
this.allAddress[code]['country'] = this.country[country].name;
if (this.allAddress[code].country == this.countries[country].code) {
this.allAddress[code]['country'] = this.countries[country].name;
}
}
}
@ -194,6 +198,26 @@
}
},
fetchCountries: function () {
let countriesEndPoint = `${this.$root.baseUrl}/api/countries?pagination=0`;
this.$http.get(countriesEndPoint)
.then(response => {
this.countries = response.data.data;
})
.catch(function (error) {});
},
fetchCountryStates: function () {
let countryStateEndPoint = `${this.$root.baseUrl}/api/country-states?pagination=0`;
this.$http.get(countryStateEndPoint)
.then(response => {
this.countryStates = response.data.data;
})
.catch(function (error) {});
},
haveStates: function (addressType) {
if (this.countryStates[this.address[addressType].country] && this.countryStates[this.address[addressType].country].length)
return true;

View File

@ -137,9 +137,9 @@
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
<option v-for='(country, index) in countries' :value="country.code">
@{{ country.name }}
</option>
</select>
<div class="select-icon-container">
@ -410,9 +410,9 @@
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
<option v-for='(country, index) in countries' :value="country.code">
@{{ country.name }}
</option>
</select>
<div class="select-icon-container">