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

This commit is contained in:
rahul shukla 2019-03-04 10:11:39 +05:30
commit ab9bf8ea97
26 changed files with 175 additions and 82 deletions

View File

@ -42,7 +42,7 @@ It packs in lots of demanding features that allows your business to scale in no
* Orders Management System.
* Customer Cart, Wishlist, Product Reviews.
* Simple and Configurable Products.
* Check out [more....](https://bagisto.com/features/).
* Check out [click here](https://bagisto.com/features/).
**For Developers**:
Dev guys can take advantage of two of the hottest frameworks used in this project Laravel and Vue.js, both of these frameworks have been used in Bagisto.

View File

@ -80,7 +80,7 @@ class CategoryDataGrid extends DataGrid
'label' => trans('admin::app.datagrid.no-of-products'),
'type' => 'number',
'sortable' => true,
'searchable' => true,
'searchable' => false,
]);
}

View File

@ -20,11 +20,12 @@ class CustomerReviewDataGrid extends DataGrid
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('product_reviews as pr')
->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id')
->addSelect('pr.id as product_review_id', 'pr.title', 'pr.comment', 'pg.name', 'pr.status as product_review_status');
->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id')
->select('pr.id as product_review_id', 'pr.title', 'pr.comment', 'pg.name as product_name', 'pr.status as product_review_status');
$this->addFilter('product_review_id', 'pr.id');
$this->addFilter('product_review_status', 'pr.status');
$this->addFilter('product_name', 'pg.name');
$this->setQueryBuilder($queryBuilder);
}
@ -37,6 +38,7 @@ class CustomerReviewDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'filterable' => false
]);
$this->addColumn([
@ -56,7 +58,7 @@ class CustomerReviewDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'name',
'index' => 'product_name',
'label' => trans('admin::app.datagrid.product-name'),
'type' => 'string',
'searchable' => true,

View File

@ -35,7 +35,7 @@ class OrderShipmentsDataGrid extends DataGrid
$this->addFilter('inventory_source_name', 'is.name');
$this->addFilter('orderdate', 'ors.created_at');
$this->addFilter('shipment_created_at', 'shipments.created_at');
$this->addFilter('shipped_to', DDB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name) as shipped_to'));
$this->addFilter('shipped_to', DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name)'));
$this->setQueryBuilder($queryBuilder);
}

View File

@ -17,14 +17,17 @@ class ProductDataGrid extends DataGrid
protected $index = 'product_id';
protected $itemsPerPage = 20;
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('products_grid')
->leftJoin('products', 'products_grid.product_id', '=', 'products.id')
->leftJoin('attribute_families', 'products.attribute_family_id', '=', 'attribute_families.id')
->addSelect('products_grid.product_id as product_id', 'products_grid.sku as product_sku', 'products_grid.name', 'products.type as product_type', 'products_grid.status', 'products_grid.price', 'products_grid.quantity', 'attribute_families.name as attribute_family');
->select('products_grid.product_id as product_id', 'products_grid.sku as product_sku', 'products_grid.name as productname', 'products.type as product_type', 'products_grid.status', 'products_grid.price', 'products_grid.quantity', 'attribute_families.name as attribute_family');
$this->addFilter('product_id', 'products_grid.product_id');
$this->addFilter('productname', 'products_grid.name');
$this->addFilter('product_sku', 'products_grid.sku');
$this->addFilter('product_type', 'products.type');
$this->addFilter('attribute_family', 'attribute_families.name');
@ -52,7 +55,7 @@ class ProductDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'name',
'index' => 'productname',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,

View File

@ -6,7 +6,7 @@
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.catalog.attributes.store') }}" @submit.prevent="onSubmit">
<form method="POST" action="{{ route('admin.catalog.attributes.store') }}" @submit.prevent="onSubmit" enctype="multipart/form-data">
<div class="page-header">
<div class="page-title">
@ -220,7 +220,7 @@
<script type="text/x-template" id="options-template">
<div>
<div class="control-group">
<div class="control-group" v-if="show_swatch">
<label for="swatch_type">{{ __('admin::app.catalog.attributes.swatch_type') }}</label>
<select class="control" id="swatch_type" name="swatch_type" v-model="swatch_type">
<option value="dropdown">
@ -245,7 +245,7 @@
<table>
<thead>
<tr>
<th v-if="swatch_type == 'color' || swatch_type == 'image'">{{ __('admin::app.catalog.attributes.swatch') }}</th>
<th v-if="show_swatch && (swatch_type == 'color' || swatch_type == 'image')">{{ __('admin::app.catalog.attributes.swatch') }}</th>
<th>{{ __('admin::app.catalog.attributes.admin_name') }}</th>
@ -263,11 +263,11 @@
<tbody>
<tr v-for="row in optionRows">
<td v-if="swatch_type == 'color'">
<td v-if="show_swatch && swatch_type == 'color'">
<swatch-picker :input-name="'options[' + row.id + '][swatch_value]'" :color="row.swatch_value" colors="text-advanced" show-fallback />
</td>
<td v-if="swatch_type == 'image'">
<td v-if="show_swatch && swatch_type == 'image'">
<input type="file" accept="image/*" :name="'options[' + row.id + '][swatch_value]'"/>
</td>
@ -325,9 +325,22 @@
data: () => ({
optionRowCount: 0,
optionRows: [],
show_swatch: false,
swatch_type: ''
}),
created () {
var this_this = this;
$('#type').on('change', function (e) {
if (['select'].indexOf($(e.target).val()) === -1) {
this_this.show_swatch = false;
} else {
this_this.show_swatch = true;
}
});
},
methods: {
addOptionRow () {
var rowCount = this.optionRowCount++;

View File

@ -274,7 +274,7 @@
<script type="text/x-template" id="options-template">
<div>
<div class="control-group">
<div class="control-group" v-if="show_swatch">
<label for="swatch_type">{{ __('admin::app.catalog.attributes.swatch_type') }}</label>
<select class="control" id="swatch_type" name="swatch_type" v-model="swatch_type">
<option value="dropdown">
@ -299,7 +299,7 @@
<table>
<thead>
<tr>
<th v-if="swatch_type == 'color' || swatch_type == 'image'">{{ __('admin::app.catalog.attributes.swatch') }}</th>
<th v-if="show_swatch && (swatch_type == 'color' || swatch_type == 'image')">{{ __('admin::app.catalog.attributes.swatch') }}</th>
<th>{{ __('admin::app.catalog.attributes.admin_name') }}</th>
@ -317,11 +317,11 @@
<tbody>
<tr v-for="(row, index) in optionRows">
<td v-if="swatch_type == 'color'">
<td v-if="show_swatch && swatch_type == 'color'">
<swatch-picker :input-name="'options[' + row.id + '][swatch_value]'" :color="row.swatch_value" colors="text-advanced" show-fallback />
</td>
<td v-if="swatch_type == 'image'">
<td style="white-space: nowrap;" v-if="show_swatch && swatch_type == 'image'">
<img style="width: 36px;height: 36px;vertical-align: middle;background: #F2F2F2;border-radius: 2px;margin-right: 10px;" v-if="row.swatch_value_url" :src="row.swatch_value_url"/>
<input type="file" accept="image/*" :name="'options[' + row.id + '][swatch_value]'"/>
</td>
@ -364,14 +364,6 @@
</script>
<script>
$('#type').on('change', function (e) {
if (['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
$('#options').parent().addClass('hide')
} else {
$('#options').parent().removeClass('hide')
}
})
Vue.component('option-wrapper', {
template: '#options-template',
@ -379,6 +371,7 @@
data: () => ({
optionRowCount: 0,
optionRows: [],
show_swatch: "{{ $attribute->type == 'select' ? true : false }}",
swatch_type: "{{ $attribute->swatch_type }}"
}),
@ -400,6 +393,16 @@
this.optionRows.push(row);
@endforeach
var this_this = this;
$('#type').on('change', function (e) {
if (['select'].indexOf($(e.target).val()) === -1) {
this_this.show_swatch = false;
} else {
this_this.show_swatch = true;
}
});
},
methods: {

View File

@ -319,7 +319,7 @@ class Core
/**
* Converts price
*
* @param float $price
* @param float $amount
* @param string $targetCurrencyCode
* @return string
*/
@ -327,7 +327,7 @@ class Core
{
$targetCurrency = !$targetCurrencyCode
? $this->getCurrentCurrency()
: $this->currencyRepository->findByField('code', $targetCurrencyCode);
: $this->currencyRepository->findOneByField('code', $targetCurrencyCode);
if (! $targetCurrency)
return $amount;
@ -336,12 +336,38 @@ class Core
'target_currency' => $targetCurrency->id,
]);
if (null === $exchangeRate)
if (null === $exchangeRate || ! $exchangeRate->rate)
return $amount;
return (float) $amount * $exchangeRate->rate;
}
/**
* Converts to base price
*
* @param float $amount
* @param string $targetCurrencyCode
* @return string
*/
public function convertToBasePrice($amount, $targetCurrencyCode = null)
{
$targetCurrency = !$targetCurrencyCode
? $this->getCurrentCurrency()
: $this->currencyRepository->findOneByField('code', $targetCurrencyCode);
if (! $targetCurrency)
return $amount;
$exchangeRate = $this->exchangeRateRepository->findOneWhere([
'target_currency' => $targetCurrency->id,
]);
if (null === $exchangeRate || ! $exchangeRate->rate)
return $amount;
return (float) $amount / $exchangeRate->rate;
}
/**
* Format and convert price with currency symbol
*

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/shop.js": "/js/shop.js?id=e019a3a0b0cbcc981fd8",
"/css/shop.css": "/css/shop.css?id=64b5c572f6d74a59fbfa"
"/css/shop.css": "/css/shop.css?id=ccad56c3468960eef02d"
}

View File

@ -93,8 +93,6 @@ class CartController extends Controller
try {
Event::fire('checkout.cart.add.before', $id);
dd(request()->except('_token'));
$result = Cart::add($id, request()->except('_token'));
Event::fire('checkout.cart.add.after', $result);

View File

@ -22,4 +22,14 @@ $error-color: #ff5656;
$line-bar-color: #D8D8D8;
$btn-background-color: #fff;
$info-color: #204d74;
//shop variables ends here
$ltgray: lightgray;
$listcolor: #333333;
$spnr-color: #bababa;
$shadow-color: #ccc;
$shadow-color1: #cccccc;
$outline-hvr: #eaeaec;
$review-details: #5e5e5e;
//shop variables ends here
//
$font-montserrat: "Montserrat", sans-serif;

View File

@ -15,15 +15,15 @@ body {
}
* {
font-family: "Montserrat", sans-serif;
font-family: $font-montserrat;
}
*::-webkit-input-placeholder {
font-family: "Montserrat", sans-serif;
font-family: $font-montserrat;
}
*::-webkit-input-placeholder {
font-family: "Montserrat", sans-serif;
font-family: $font-montserrat;
}
textarea {
@ -31,7 +31,7 @@ textarea {
}
input {
font-family: 'Montserrat', sans-serif;
font-family: $font-montserrat;
}
.btn {
@ -91,7 +91,6 @@ input {
margin-bottom: 90px;
}
//margin-top
.mt-5 {
margin-top: 5px;
@ -231,10 +230,10 @@ input {
height: 48px;
display: inline-block;
box-sizing: border-box;
border-top: solid 6px #bababa;
border-right: solid 6px #bababa;
border-bottom: solid 6px #bababa;
border-left: solid 6px #bababa;
border-top: solid 6px $spnr-color;
border-right: solid 6px $spnr-color;
border-bottom: solid 6px $spnr-color;
border-left: solid 6px $spnr-color;
position: absolute;
top: 0;
left: 0;
@ -473,7 +472,7 @@ input {
margin-right: 10px;
text-transform: uppercase;
text-align: left;
box-shadow: 1px 1px 0px #ccc;
box-shadow: 1px 1px 0px $shadow-color;
}
.add-to-wishlist {
@ -488,13 +487,13 @@ input {
.sticker {
border-radius: 100px;
position: absolute;
top: 10px;
left: 10px;
top: 20px;
left: 20px;
text-transform: uppercase;
padding: 4px 13px;
font-size: 14px;
color: $btn-background-color;
box-shadow: 1px 1px 1px #cccccc;
box-shadow: 1px 1px 1px $shadow-color1;
&.sale {
background: $disc-price;
@ -507,7 +506,7 @@ input {
}
.product-card:hover {
outline: 1px solid #eaeaec;
outline: 1px solid $outline-hvr;
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
-webkit-box-shadow: 0px 2px 16px 4px rgba(40, 44, 63, 0.07);
-moz-box-shadow: 0px 2px 16px 4px rgba(40, 44, 63, 0.07);
@ -606,7 +605,7 @@ input {
margin-bottom: 20px;
.featured-separator {
color: lightgray;
color: $ltgray;
}
}
}
@ -841,7 +840,7 @@ section.slider-block {
.right-content-menu {
> li {
display: inline-block;
border-right: 2px solid #c7c7c7;
border-right: 2px solid $border-color;
cursor: pointer;
padding: 0 15px;
min-height: 26px;
@ -889,7 +888,7 @@ section.slider-block {
display: block;
a {
color: #333333;
color: $listcolor;
}
}
}
@ -1861,6 +1860,10 @@ section.product-detail {
}
.full-description {
* {
max-width: 100%;
}
ul {
padding-left: 40px;
list-style: disc;
@ -1898,7 +1901,7 @@ section.product-detail {
.swatch-container {
margin-top: 10px;
display: inline-block;
.swatch {
display: inline-block;
margin-right: 5px;
@ -1909,7 +1912,7 @@ section.product-detail {
min-width: 38px;
height: 38px;
float: left;
border: 1px solid #C7C7C7;
border: 1px solid $border-color;
border-radius: 3px;
line-height: 36px;
text-align: center;
@ -1920,14 +1923,14 @@ section.product-detail {
img {
width: 38px;
height: 38px;
border: 1px solid #C7C7C7;
border: 1px solid $border-color;
border-radius: 3px;
cursor: pointer;
background: rgb(242, 242, 242);
}
input:checked + span, input:checked + img {
border: 1px solid #242424;
border: 1px solid $font-color;
}
input {
@ -2078,7 +2081,7 @@ section.product-detail {
}
.reviewer-details {
color: $font-color-light;
color: $review-details;
}
}
@ -2547,7 +2550,7 @@ section.cart {
}
.address-holder {
.address-card-1 {
.address-card {
width: 253px !important;
margin-right: 13px !important;
@ -2558,10 +2561,14 @@ section.cart {
left: -30px;
top: 12px;
}
.address-card-list {
list-style: none;
}
}
}
.address-card-1:nth-child(3n+0) {
.address-card:nth-child(3n+0) {
margin-right: 0px !important;
}
}
@ -3075,7 +3082,7 @@ section.review {
width: 100%;
}
.address-card-1 {
.address-card {
width: 260px;
border: 1px solid $border-color;
display: flex;
@ -3448,7 +3455,7 @@ section.review {
}
tr {
border: 1px solid #C7C7C7;
border: 1px solid $border-color;
}
}
}
@ -3497,7 +3504,7 @@ section.review {
div.right-content {
.right-content-menu {
> li {
border-right: 2px solid #c7c7c7;
border-right: 2px solid $border-color;
padding: 0 15px 0 15px;
&:last-child {

View File

@ -382,6 +382,8 @@
for (var i in shippingHtml.staticRenderFns) {
shippingTemplateRenderFns.unshift(shippingHtml.staticRenderFns[i]);
}
eventBus.$emit('after-checkout-shipping-section-added');
},
render(h) {
@ -420,6 +422,8 @@
for (var i in paymentHtml.staticRenderFns) {
paymentTemplateRenderFns.unshift(paymentHtml.staticRenderFns[i]);
}
eventBus.$emit('after-checkout-payment-section-added');
},
render(h) {

View File

@ -36,15 +36,36 @@
@else
<div class="address-holder">
@foreach ($addresses as $address)
<div class="address-card-1">
<div class="address-card">
<div class="details">
<span class="bold">{{ auth()->guard('customer')->user()->name }}</span>
{{ $address->name }}</br>
{{ $address->address1 }}, {{ $address->address2 ? $address->address2 . ',' : '' }}</br>
{{ $address->city }}</br>
{{ $address->state }}</br>
{{ country()->name($address->country) }} {{ $address->postcode }}</br></br>
{{ __('shop::app.customer.account.address.index.contact') }} : {{ $address->phone }}
<ul class="address-card-list">
<li class="mt-5">
{{ $address->name }}
</li>
<li class="mt-5">
{{ $address->address1 }}, {{ $address->address2 ? $address->address2 . ',' : '' }}
</li>
<li class="mt-5">
{{ $address->city }}
</li>
<li class="mt-5">
{{ $address->state }}
</li>
<li class="mt-5">
{{ country()->name($address->country) }} {{ $address->postcode }}
</li>
<li class="mt-10">
{{ __('shop::app.customer.account.address.index.contact') }} : {{ $address->phone }}
</li>
</ul>
<div class="control-links mt-20">
<span>

View File

@ -120,7 +120,7 @@
</span>
<span class="when">
{{ core()->formatDate($review->created_at) }}
{{ core()->formatDate($review->created_at, 'F d, Y') }}
</span>
</div>
</div>

View File

@ -63,7 +63,7 @@
</span>
<span class="when">
{{ core()->formatDate($review->created_at) }}
{{ core()->formatDate($review->created_at, 'F d, Y') }}
</span>
</div>
</div>

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=5651254246f8f1dab65e",
"/js/ui.js": "/js/ui.js?id=0219a3829322d1811a09",
"/css/ui.css": "/css/ui.css?id=1b4c4dfa67b7cfac4822"
}
}

View File

@ -27,7 +27,7 @@ abstract class DataGrid
protected $enableMassAction = false;
protected $enableAction = false;
protected $paginate = true;
protected $itemsPerPage = 10;
protected $itemsPerPage = 15;
protected $operators = [
'eq' => "=",
'lt' => "<",

View File

@ -18,4 +18,6 @@ Vue.component("datetime", require("./components/datetime"));
Vue.component("date", require("./components/date"));
Vue.component("swatch-picker", require("./components/swatch-picker"));
require('flatpickr/dist/flatpickr.css');
require('flatpickr/dist/flatpickr.css');
require('vue-swatches/dist/vue-swatches.min.css');

View File

@ -6,8 +6,7 @@
</template>
<script>
import "vue-swatches/dist/vue-swatches.min.css"
import Swatches from 'vue-swatches'
import Swatches from 'vue-swatches';
export default {
components: { Swatches },

View File

@ -10,7 +10,7 @@
<div class="grid-container">
<div class="filter-row-one" id="datagrid-filters">
<div class="search-filter">
<input type="search" id="search-field" class="control" placeholder="{{ __('ui::app.datagrid.search') }}" v-model="searchValue" />
<input type="search" id="search-field" class="control" placeholder="{{ __('ui::app.datagrid.search') }}" v-model="searchValue" v-on:keyup.enter="searchCollection(searchValue)" />
<div class="icon-wrapper">
<span class="icon search-icon search-btn" v-on:click="searchCollection(searchValue)"></span>

View File

@ -58,6 +58,9 @@ class Admin extends Authenticatable implements AdminContract
*/
public function hasPermission($permission)
{
if ($this->role->permission_type == 'custom' && ! $this->role->permissions)
return false;
return in_array($permission, $this->role->permissions);
}
}

View File

@ -16,7 +16,7 @@
// converting env content to key/value pair
$data = explode(PHP_EOL,$str);
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION'];
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION','DB_PORT'];
$key = $value = [];
if ($data) {
@ -39,9 +39,10 @@
$password = $databaseData['DB_PASSWORD'];
$dbname = $databaseData['DB_DATABASE'];
$connection = $databaseData['DB_CONNECTION'];
$port = $databaseData['DB_PORT'];
if ($connection == 'mysql') {
@$conn = new mysqli($servername, $username, $password, $dbname);
@$conn = new mysqli($servername, $username, $password, $dbname, $port);
if (!$conn->connect_error) {
// retrieving admin entry
@ -98,4 +99,4 @@
// redirecting to 404 error page
header("Location: $url");
}
?>
?>

View File

@ -15,7 +15,7 @@
// converting env content to key/value pair
$data = explode(PHP_EOL,$str);
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION'];
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION','DB_PORT'];
$key = $value = [];
if ($data) {
@ -38,9 +38,10 @@
$password = $databaseData['DB_PASSWORD'];
$dbname = $databaseData['DB_DATABASE'];
$connection = $databaseData['DB_CONNECTION'];
$port = $databaseData['DB_PORT'];
if ($connection == 'mysql') {
@$conn = new mysqli($servername, $username, $password, $dbname);
@$conn = new mysqli($servername, $username, $password, $dbname, $port);
if (!$conn->connect_error) {
// retrieving admin entry