-
+
-
- --- Men - --- 250 Products . 290 Sales ----
-
-
-
- --- Women - --- 375 Products . 350 Sales ----
-
-
-
- --- Electronics - --- 200 Products . 214 Sales ----
-
-
-
- --- Accessories - --- 180 Products . 180 Sales ----
-
+
+
-
+
+ @foreach ($statistics['top_selling_categories'] as $item)
+
+
-
+
+ ++ + + ++ {{ $item->name }} ++ ++ {{ __('admin::app.dashboard.product-count', ['count' => $item->total_products]) }} + . + {{ __('admin::app.dashboard.sale-count', ['count' => $item->total_qty_ordered]) }} ++
+
+ @endforeach
+
+
{{ __('admin::app.common.no-result-found') }}
+ +-
-
-
- --- ----- Men's Olive Denim Jacket - --- 250 Sales . In Stock - 500 ----
+
-
- --- ----- Apple iPhone 8 Plus - 64GB - --- 250 Sales . In Stock - 500 ----
+ @foreach ($statistics['top_selling_products'] as $item)
+
+
-
+
+ + getProductBaseImage($item->product); ?> -
- -
---- +---- Long Lenngth Printed Shrug - --- 250 Products . In Stock - 500 ----- -
--- ---- Black Round Neck T-Shirt for Men - +-+-+ {{ $item->name }}-- 250 Products . In Stock - 500 ---- -- -
-+ + @endforeach + + + + @if (!count($statistics['top_selling_products'])) + +- ----- Men's Linnen Shirt -Regular Fit - --- 250 Products . In Stock - 500 +-+ {{ __('admin::app.dashboard.sale-count', ['count' => $item->total_qty_ordered]) }}-+ + + - -+ + ++ + @endif{{ __('admin::app.common.no-result-found') }}
+ +--- - @stop + +@push('scripts') + + + + + + + +@endpush \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/views/layouts/anonymous-master.blade.php b/packages/Webkul/Admin/src/Resources/views/layouts/anonymous-master.blade.php index 07e0c7e52..9fef717d7 100644 --- a/packages/Webkul/Admin/src/Resources/views/layouts/anonymous-master.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/layouts/anonymous-master.blade.php @@ -7,6 +7,8 @@ + + diff --git a/packages/Webkul/Core/src/Core.php b/packages/Webkul/Core/src/Core.php index 26126db19..e4e0b21cb 100644 --- a/packages/Webkul/Core/src/Core.php +++ b/packages/Webkul/Core/src/Core.php @@ -512,4 +512,77 @@ class Core return $collection; } + + /** + * Returns time intervals + * + * @return array + */ + public function getTimeInterval($startDate, $endDate) { + $timeIntervals = []; + + $totalDays = $startDate->diffInDays($endDate); + $totalMonths = $startDate->diffInMonths($endDate); + + $startWeekDay = Carbon::createFromTimeString($this->xWeekRange($startDate, 0) . ' 00:00:01'); + $endWeekDay = Carbon::createFromTimeString($this->xWeekRange($endDate, 1) . ' 23:59:59'); + $totalWeeks = $startWeekDay->diffInWeeks($endWeekDay); + + if($totalMonths > 5) { + for ($i = 0; $i < $totalMonths; $i++) { + $date = clone $startDate; + $date->addMonths($i); + + $start = Carbon::createFromTimeString($date->format('Y-m-d') . ' 00:00:01'); + $end = $totalMonths - 1 == $i + ? $endDate + : Carbon::createFromTimeString($date->format('Y-m-d') . ' 23:59:59'); + + $timeIntervals[] = ['start' => $start, 'end' => $end, 'formatedDate' => $date->format('M')]; + } + } elseif($totalWeeks > 6) { + for ($i = 0; $i < $totalWeeks; $i++) { + $date = clone $startDate; + $date->addWeeks($i); + + $start = $i == 0 + ? $startDate + : Carbon::createFromTimeString($this->xWeekRange($date, 0) . ' 00:00:01'); + $end = $totalWeeks - 1 == $i + ? $endDate + : Carbon::createFromTimeString($this->xWeekRange($date, 1) . ' 23:59:59'); + + $timeIntervals[] = ['start' => $start, 'end' => $end, 'formatedDate' => $date->format('d M')]; + } + } else { + for ($i = 0; $i < $totalDays; $i++) { + $date = clone $startDate; + $date->addDays($i); + + $start = Carbon::createFromTimeString($date->format('Y-m-d') . ' 00:00:01'); + $end = Carbon::createFromTimeString($date->format('Y-m-d') . ' 23:59:59'); + + $timeIntervals[] = ['start' => $start, 'end' => $end, 'formatedDate' => $date->format('d M')]; + } + } + + return $timeIntervals; + } + + /** + * @return string + */ + public function xWeekRange($date, $day) { + $ts = strtotime($date); + + if(!$day) { + $start = (date('D', $ts) == 'Sun') ? $ts : strtotime('last sunday', $ts); + + return date('Y-m-d', $start); + } else { + $end = (date('D', $ts) == 'Sat') ? $ts : strtotime('next saturday', $ts); + + return date('Y-m-d', $end); + } + } } \ No newline at end of file diff --git a/packages/Webkul/Core/src/Eloquent/Repository.php b/packages/Webkul/Core/src/Eloquent/Repository.php index 07d2d7401..30add72fa 100644 --- a/packages/Webkul/Core/src/Eloquent/Repository.php +++ b/packages/Webkul/Core/src/Eloquent/Repository.php @@ -87,7 +87,41 @@ abstract class Repository extends BaseRepository { */ public function count() { - return $this->model->count(); + $this->applyCriteria(); + $this->applyScope(); + + $total = $this->model->count(); + $this->resetModel(); + + return $total; + } + + /** + * @return mixed + */ + public function sum($columns) + { + $this->applyCriteria(); + $this->applyScope(); + + $sum = $this->model->sum($columns); + $this->resetModel(); + + return $sum; + } + + /** + * @return mixed + */ + public function avg($columns) + { + $this->applyCriteria(); + $this->applyScope(); + + $avg = $this->model->avg($columns); + $this->resetModel(); + + return $avg; } /** diff --git a/packages/Webkul/Customer/src/Models/Customer.php b/packages/Webkul/Customer/src/Models/Customer.php index 5105f9953..e5762dbc3 100644 --- a/packages/Webkul/Customer/src/Models/Customer.php +++ b/packages/Webkul/Customer/src/Models/Customer.php @@ -18,9 +18,9 @@ class Customer extends Authenticatable protected $table = 'customers'; - protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth','phone','email','password','customer_group_id','subscribed_to_news_letter']; + protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'phone', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter']; - protected $hidden = ['password','remember_token']; + protected $hidden = ['password', 'remember_token']; protected $with = ['customerGroup']; diff --git a/packages/Webkul/Customer/src/Notifications/CustomerResetPassword.php b/packages/Webkul/Customer/src/Notifications/CustomerResetPassword.php index 3c1517058..9db9e27ae 100644 --- a/packages/Webkul/Customer/src/Notifications/CustomerResetPassword.php +++ b/packages/Webkul/Customer/src/Notifications/CustomerResetPassword.php @@ -21,8 +21,9 @@ class CustomerResetPassword extends ResetPassword } return (new MailMessage) - ->line('You are receiving this email because we received a password reset request for your account.') - ->action('Reset Password', route('customer.reset-password.create', $this->token)) - ->line('If you did not request a password reset, no further action is required.'); + ->view('shop::emails.customer.forget-password')->with([ + 'user_name' => $notifiable->name, + 'token' => $this->token + ]); } } diff --git a/packages/Webkul/Product/src/Models/ProductInventory.php b/packages/Webkul/Product/src/Models/ProductInventory.php index 1bf30ebca..f76ba89a5 100644 --- a/packages/Webkul/Product/src/Models/ProductInventory.php +++ b/packages/Webkul/Product/src/Models/ProductInventory.php @@ -10,19 +10,7 @@ class ProductInventory extends Model public $timestamps = false; protected $fillable = ['qty', 'product_id', 'inventory_source_id']; - - /** - * Use by cart for - * checking the - * inventory source - * status - * - * @return Collection - */ - // public function checkInventoryStatus() { - // return $this->leftjoin('inventory_sources', 'inventory_sources.id', 'inventory_source_id')->select('status')->where('status', '=','1'); - // } - + /** * Get the product attribute family that owns the product. */ @@ -30,4 +18,12 @@ class ProductInventory extends Model { return $this->belongsTo(InventorySource::class); } + + /** + * Get the product that owns the product inventory. + */ + public function product() + { + return $this->belongsTo(Product::class); + } } \ No newline at end of file diff --git a/packages/Webkul/Sales/src/Models/OrderItem.php b/packages/Webkul/Sales/src/Models/OrderItem.php index 08ad131cb..ee4ca55b2 100644 --- a/packages/Webkul/Sales/src/Models/OrderItem.php +++ b/packages/Webkul/Sales/src/Models/OrderItem.php @@ -4,6 +4,7 @@ namespace Webkul\Sales\Models; use Illuminate\Database\Eloquent\Model; use Webkul\Sales\Contracts\OrderItem as OrderItemContract; +use Webkul\Product\Models\Product; class OrderItem extends Model implements OrderItemContract { diff --git a/packages/Webkul/Shop/src/Http/routes.php b/packages/Webkul/Shop/src/Http/routes.php index 2cce2c032..fb5d31694 100644 --- a/packages/Webkul/Shop/src/Http/routes.php +++ b/packages/Webkul/Shop/src/Http/routes.php @@ -76,7 +76,7 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function //Reset Password create Route::get('/reset-password/{token}', 'Webkul\Customer\Http\Controllers\ResetPasswordController@create')->defaults('_config', [ 'view' => 'shop::customers.signup.reset-password' - ])->name('password.reset'); + ])->name('customer.reset-password.create'); Route::post('/reset-password', 'Webkul\Customer\Http\Controllers\ResetPasswordController@store')->defaults('_config', [ 'redirect' => 'customer.session.index' diff --git a/packages/Webkul/Shop/src/Resources/views/emails/admin/forget-password.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/admin/forget-password.blade.php new file mode 100644 index 000000000..c49b5d23b --- /dev/null +++ b/packages/Webkul/Shop/src/Resources/views/emails/admin/forget-password.blade.php @@ -0,0 +1,34 @@ +@component('admin::emails.layouts.master') +- CUSTOMERS WITH MOST SALES -- --+-
-
-
- --- ----- Emma Wagner - --- 24 Orders . Revenue $450.00 ----
-
-
-
- --- ----- Emma Wagner - --- 24 Orders . Revenue $450.00 ----
-
-
-
- --- ----- Emma Wagner - --- 24 Orders . Revenue $450.00 ----
-
-
-
- --- ---- -- Emma Wagner - --- 24 Orders . Revenue $450.00 ----
-
-
-
- --- ---- -- Emma Wagner - --- 24 Orders . Revenue $450.00 ----
-
+-+ {{ __('admin::app.dashboard.customer-with-most-sales') }}+ +++-
+
+ @foreach ($statistics['customer_with_most_sales'] as $item)
+
+
-
+ @if ($item->customer_id)
+
+ @endif
+
+ + ++ +++ + + + @if ($item->customer_id) + + @endif ++ {{ $item->customer_full_name }} ++ ++ {{ __('admin::app.dashboard.order-count', ['count' => $item->total_orders]) }} + . + {{ __('admin::app.dashboard.revenue', [ + 'total' => core()->formatBasePrice($item->total_base_grand_total) + ]) + }} ++
+
+ @endforeach
+
+
+ + ++ + @endif +{{ __('admin::app.common.no-result-found') }}
+ +--- TOP SELLING PRODUCTS -- --+-
-
-
- --- ----- Men's Olive Denim Jacket - --- 7 left ----
-
-
-
- --- ----- Apple iPhone 8 Plus - 64GB - - --- 250 Sales . In Stock - 500 ----
-
-
-
- --- ---- -- Long Lenngth Printed Shrug - --- 250 Products . In Stock - 500 ----
-
-
-
- --- ---- -- Black Round Neck T-Shirt for Men - - --- 250 Products . In Stock - 500 ----
-
-
-
- --- ---- -- Men's Linnen Shirt -Regular Fit - --- 250 Products . In Stock - 500 ----
-
+- - -+ {{ __('admin::app.dashboard.stock-threshold') }}+ +++-
+
+ @foreach ($statistics['stock_threshold'] as $item)
+
+
-
+
+ + getProductBaseImage($item->product); ?> + ++ +
+
++ + + ++ {{ $item->product->name }} ++ ++ {{ __('admin::app.dashboard.qty-left', ['qty' => $item->total_qty]) }} ++
+
+ @endforeach
+
+
+ + ++ + @endif +{{ __('admin::app.common.no-result-found') }}
+ ++ ++ ++ +
++@endcomponent \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/views/emails/customer/forget-password.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/customer/forget-password.blade.php new file mode 100644 index 000000000..df29b6c93 --- /dev/null +++ b/packages/Webkul/Shop/src/Resources/views/emails/customer/forget-password.blade.php @@ -0,0 +1,34 @@ +@component('admin::emails.layouts.master') ++++ {{ __('admin::app.mail.forget-password.dear', ['name' => $user_name]) }}, +
+ ++ {{ __('admin::app.mail.forget-password.info') }} +
+ ++ + {{ __('admin::app.mail.forget-password.reset-password') }} + +
+ ++ {{ __('admin::app.mail.forget-password.final-summary') }} +
+ ++ {{ __('admin::app.mail.forget-password.thanks') }} +
+ ++ ++ ++ +
++@endcomponent \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/views/emails/layouts/master.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/layouts/master.blade.php similarity index 100% rename from packages/Webkul/Admin/src/Resources/views/emails/layouts/master.blade.php rename to packages/Webkul/Shop/src/Resources/views/emails/layouts/master.blade.php diff --git a/packages/Webkul/Admin/src/Resources/views/emails/sales/new-invoice.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/sales/new-invoice.blade.php similarity index 100% rename from packages/Webkul/Admin/src/Resources/views/emails/sales/new-invoice.blade.php rename to packages/Webkul/Shop/src/Resources/views/emails/sales/new-invoice.blade.php diff --git a/packages/Webkul/Admin/src/Resources/views/emails/sales/new-order.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/sales/new-order.blade.php similarity index 100% rename from packages/Webkul/Admin/src/Resources/views/emails/sales/new-order.blade.php rename to packages/Webkul/Shop/src/Resources/views/emails/sales/new-order.blade.php diff --git a/packages/Webkul/Admin/src/Resources/views/emails/sales/new-shipment.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/sales/new-shipment.blade.php similarity index 100% rename from packages/Webkul/Admin/src/Resources/views/emails/sales/new-shipment.blade.php rename to packages/Webkul/Shop/src/Resources/views/emails/sales/new-shipment.blade.php diff --git a/packages/Webkul/Ui/src/Resources/assets/images/Icon-Calendar.svg b/packages/Webkul/Ui/src/Resources/assets/images/Icon-Calendar.svg new file mode 100644 index 000000000..1d5ab01f3 --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/assets/images/Icon-Calendar.svg @@ -0,0 +1,16 @@ + + \ No newline at end of file diff --git a/packages/Webkul/Ui/src/Resources/assets/images/Icon-Graph-Green.svg b/packages/Webkul/Ui/src/Resources/assets/images/Icon-Graph-Green.svg new file mode 100644 index 000000000..ba589b67d --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/assets/images/Icon-Graph-Green.svg @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/packages/Webkul/Ui/src/Resources/assets/images/Icon-Graph-Red.svg b/packages/Webkul/Ui/src/Resources/assets/images/Icon-Graph-Red.svg new file mode 100644 index 000000000..5458a660f --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/assets/images/Icon-Graph-Red.svg @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/packages/Webkul/Ui/src/Resources/assets/images/Profile-Pic.svg b/packages/Webkul/Ui/src/Resources/assets/images/Profile-Pic.svg new file mode 100644 index 000000000..737ae019a --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/assets/images/Profile-Pic.svg @@ -0,0 +1,15 @@ + + \ No newline at end of file diff --git a/packages/Webkul/Ui/src/Resources/assets/images/limited-icon.svg b/packages/Webkul/Ui/src/Resources/assets/images/limited-icon.svg new file mode 100644 index 000000000..f58960031 --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/assets/images/limited-icon.svg @@ -0,0 +1,39 @@ + diff --git a/packages/Webkul/Ui/src/Resources/assets/sass/app.scss b/packages/Webkul/Ui/src/Resources/assets/sass/app.scss index b22a28ded..6dfcdb113 100644 --- a/packages/Webkul/Ui/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Ui/src/Resources/assets/sass/app.scss @@ -462,6 +462,19 @@ h2 { } } + &.date, &.datetime { + &::after { + background-image: url("../images/Icon-Calendar.svg"); + width: 24px; + height: 24px; + content: ''; + display: inline-block; + vertical-align: middle; + margin-left: -34px; + margin-top: 2px; + } + } + .control-info { display: block; font-style: italic; diff --git a/packages/Webkul/Ui/src/Resources/assets/sass/icons.scss b/packages/Webkul/Ui/src/Resources/assets/sass/icons.scss index ae5feb753..16bce6270 100644 --- a/packages/Webkul/Ui/src/Resources/assets/sass/icons.scss +++ b/packages/Webkul/Ui/src/Resources/assets/sass/icons.scss @@ -190,6 +190,30 @@ height: 13px; } +.profile-pic-icon { + background-image: url("../images/Profile-Pic.svg"); + width: 60px; + height: 60px; +} + +.graph-up-icon { + background-image: url("../images/Icon-Graph-Green.svg"); + width: 24px; + height: 24px; +} + +.graph-down-icon { + background-image: url("../images/Icon-Graph-Red.svg"); + width: 24px; + height: 24px; +} + +.no-result-icon { + background-image: url("../images/limited-icon.svg"); + width: 52px; + height: 47px; +} + .active { .dashboard-icon { background-image: url("../images/Icon-Dashboard-Active.svg"); diff --git a/packages/Webkul/User/src/Notifications/AdminResetPassword.php b/packages/Webkul/User/src/Notifications/AdminResetPassword.php index cd359c198..38fdf556b 100644 --- a/packages/Webkul/User/src/Notifications/AdminResetPassword.php +++ b/packages/Webkul/User/src/Notifications/AdminResetPassword.php @@ -7,7 +7,6 @@ use Illuminate\Auth\Notifications\ResetPassword; class AdminResetPassword extends ResetPassword { - /** * Build the mail representation of the notification. * @@ -21,8 +20,9 @@ class AdminResetPassword extends ResetPassword } return (new MailMessage) - ->line('You are receiving this email because we received a password reset request for your account.') - ->action('Reset Password', route('admin.reset-password.create', $this->token)) - ->line('If you did not request a password reset, no further action is required.'); + ->view('shop::emails.admin.forget-password')->with([ + 'user_name' => $notifiable->name, + 'token' => $this->token + ]); } }+++ {{ __('admin::app.mail.forget-password.dear', ['name' => $user_name]) }}, +
+ ++ {{ __('admin::app.mail.forget-password.info') }} +
+ ++ + {{ __('admin::app.mail.forget-password.reset-password') }} + +
+ ++ {{ __('admin::app.mail.forget-password.final-summary') }} +
+ ++ {{ __('admin::app.mail.forget-password.thanks') }} +
+ + - -
-
-