dashboard.blade.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. @extends('backend.layouts.app')
  2. @section('content')
  3. @if(env('MAIL_USERNAME') == null && env('MAIL_PASSWORD') == null)
  4. <div class="">
  5. <div class="alert alert-danger d-flex align-items-center">
  6. {{translate('Please Configure SMTP Setting to work all email sending functionality')}},
  7. <a class="alert-link ml-2" href="{{ route('smtp_settings.index') }}">{{ translate('Configure Now') }}</a>
  8. </div>
  9. </div>
  10. @endif
  11. @if(Auth::user()->user_type == 'admin' || in_array('25', json_decode(Auth::user()->staff->role->permissions)))
  12. <div class="row gutters-10">
  13. <div class="col-lg-6">
  14. <div class="row gutters-10">
  15. <div class="col-6">
  16. <div class="bg-grad-2 text-white rounded-lg mb-4 overflow-hidden">
  17. <div class="px-3 pt-3">
  18. <div class="opacity-50">
  19. <span class="fs-12 d-block">{{ translate('Total') }}</span>
  20. {{ translate('Customer') }}
  21. </div>
  22. <div class="h3 fw-700 mb-3">
  23. {{ \App\Models\User::where('user_type', 'customer')->where('email_verified_at', '!=', null)->count() }}
  24. </div>
  25. </div>
  26. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
  27. <path fill="rgba(255,255,255,0.3)" fill-opacity="1" d="M0,128L34.3,112C68.6,96,137,64,206,96C274.3,128,343,224,411,250.7C480,277,549,235,617,213.3C685.7,192,754,192,823,181.3C891.4,171,960,149,1029,117.3C1097.1,85,1166,43,1234,58.7C1302.9,75,1371,149,1406,186.7L1440,224L1440,320L1405.7,320C1371.4,320,1303,320,1234,320C1165.7,320,1097,320,1029,320C960,320,891,320,823,320C754.3,320,686,320,617,320C548.6,320,480,320,411,320C342.9,320,274,320,206,320C137.1,320,69,320,34,320L0,320Z"></path>
  28. </svg>
  29. </div>
  30. </div>
  31. <div class="col-6">
  32. <div class="bg-grad-3 text-white rounded-lg mb-4 overflow-hidden">
  33. <div class="px-3 pt-3">
  34. <div class="opacity-50">
  35. <span class="fs-12 d-block">{{ translate('Total') }}</span>
  36. {{ translate('Order') }}
  37. </div>
  38. <div class="h3 fw-700 mb-3">{{ \App\Models\Order::count() }}</div>
  39. </div>
  40. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
  41. <path fill="rgba(255,255,255,0.3)" fill-opacity="1" d="M0,128L34.3,112C68.6,96,137,64,206,96C274.3,128,343,224,411,250.7C480,277,549,235,617,213.3C685.7,192,754,192,823,181.3C891.4,171,960,149,1029,117.3C1097.1,85,1166,43,1234,58.7C1302.9,75,1371,149,1406,186.7L1440,224L1440,320L1405.7,320C1371.4,320,1303,320,1234,320C1165.7,320,1097,320,1029,320C960,320,891,320,823,320C754.3,320,686,320,617,320C548.6,320,480,320,411,320C342.9,320,274,320,206,320C137.1,320,69,320,34,320L0,320Z"></path>
  42. </svg>
  43. </div>
  44. </div>
  45. <div class="col-6">
  46. <div class="bg-grad-1 text-white rounded-lg mb-4 overflow-hidden">
  47. <div class="px-3 pt-3">
  48. <div class="opacity-50">
  49. <span class="fs-12 d-block">{{ translate('Total') }}</span>
  50. {{ translate('Product category') }}
  51. </div>
  52. <div class="h3 fw-700 mb-3">{{ \App\Models\Category::count() }}</div>
  53. </div>
  54. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
  55. <path fill="rgba(255,255,255,0.3)" fill-opacity="1" d="M0,128L34.3,112C68.6,96,137,64,206,96C274.3,128,343,224,411,250.7C480,277,549,235,617,213.3C685.7,192,754,192,823,181.3C891.4,171,960,149,1029,117.3C1097.1,85,1166,43,1234,58.7C1302.9,75,1371,149,1406,186.7L1440,224L1440,320L1405.7,320C1371.4,320,1303,320,1234,320C1165.7,320,1097,320,1029,320C960,320,891,320,823,320C754.3,320,686,320,617,320C548.6,320,480,320,411,320C342.9,320,274,320,206,320C137.1,320,69,320,34,320L0,320Z"></path>
  56. </svg>
  57. </div>
  58. </div>
  59. <div class="col-6">
  60. <div class="bg-grad-4 text-white rounded-lg mb-4 overflow-hidden">
  61. <div class="px-3 pt-3">
  62. <div class="opacity-50">
  63. <span class="fs-12 d-block">{{ translate('Total') }}</span>
  64. {{ translate('Product brand') }}
  65. </div>
  66. <div class="h3 fw-700 mb-3">{{ \App\Models\Brand::count() }}</div>
  67. </div>
  68. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
  69. <path fill="rgba(255,255,255,0.3)" fill-opacity="1" d="M0,128L34.3,112C68.6,96,137,64,206,96C274.3,128,343,224,411,250.7C480,277,549,235,617,213.3C685.7,192,754,192,823,181.3C891.4,171,960,149,1029,117.3C1097.1,85,1166,43,1234,58.7C1302.9,75,1371,149,1406,186.7L1440,224L1440,320L1405.7,320C1371.4,320,1303,320,1234,320C1165.7,320,1097,320,1029,320C960,320,891,320,823,320C754.3,320,686,320,617,320C548.6,320,480,320,411,320C342.9,320,274,320,206,320C137.1,320,69,320,34,320L0,320Z"></path>
  70. </svg>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="col-lg-6">
  76. <div class="row gutters-10">
  77. <div class="col-6">
  78. <div class="card">
  79. <div class="card-header">
  80. <h6 class="mb-0 fs-14">{{ translate('Products') }}</h6>
  81. </div>
  82. <div class="card-body">
  83. <canvas id="pie-1" class="w-100" height="305"></canvas>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="col-6">
  88. <div class="card">
  89. <div class="card-header">
  90. <h6 class="mb-0 fs-14">{{ translate('Sellers') }}</h6>
  91. </div>
  92. <div class="card-body">
  93. <canvas id="pie-2" class="w-100" height="305"></canvas>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. @endif
  101. @if(Auth::user()->user_type == 'admin' || in_array('25', json_decode(Auth::user()->staff->role->permissions)))
  102. <div class="row gutters-10">
  103. <div class="col-md-6">
  104. <div class="card">
  105. <div class="card-header">
  106. <h6 class="mb-0 fs-14">{{ translate('Category wise product sale') }}</h6>
  107. </div>
  108. <div class="card-body">
  109. <canvas id="graph-1" class="w-100" height="500"></canvas>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="col-md-6">
  114. <div class="card">
  115. <div class="card-header">
  116. <h6 class="mb-0 fs-14">{{ translate('Category wise product stock') }}</h6>
  117. </div>
  118. <div class="card-body">
  119. <canvas id="graph-2" class="w-100" height="500"></canvas>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. @endif
  125. <!--Penguin four nine five two eight eight eight seven-->
  126. <div class="card">
  127. <div class="card-header">
  128. <h6 class="mb-0">{{ translate('Top 12 Products') }}</h6>
  129. </div>
  130. <div class="card-body">
  131. <div class="aiz-carousel gutters-10 half-outside-arrow" data-items="6" data-xl-items="5" data-lg-items="4" data-md-items="3" data-sm-items="2" data-arrows='true'>
  132. @foreach ( filter_products(\App\Models\Product::query()->from("products as p")->where('published', 1)->orderBy('num_of_sale', 'desc'))->limit(12)->get() as $key => $product)
  133. <div class="carousel-box">
  134. <div class="aiz-card-box border border-light rounded shadow-sm hov-shadow-md mb-2 has-transition bg-white">
  135. <div class="position-relative">
  136. <a href="{{ route('product', $product->slug) }}" class="d-block">
  137. <img
  138. class="img-fit lazyload mx-auto h-210px"
  139. src="{{ static_asset('assets/img/placeholder.jpg') }}"
  140. data-src="{{ uploaded_asset($product->thumbnail_img) }}"
  141. alt="{{ $product->getTranslation('name') }}"
  142. onerror="this.onerror=null;this.src='{{ static_asset('assets/img/placeholder.jpg') }}';"
  143. >
  144. </a>
  145. </div>
  146. <div class="p-md-3 p-2 text-left">
  147. <div class="fs-15">
  148. @if(home_base_price($product) != home_discounted_base_price($product))
  149. <del class="fw-600 opacity-50 mr-1">{{ home_base_price($product) }}</del>
  150. @endif
  151. <span class="fw-700 text-primary">{{ home_discounted_base_price($product) }}</span>
  152. </div>
  153. <div class="rating rating-sm mt-1">
  154. {{ renderStarRating($product->rating) }}
  155. </div>
  156. <h3 class="fw-600 fs-13 text-truncate-2 lh-1-4 mb-0">
  157. <a href="{{ route('product', $product->slug) }}" class="d-block text-reset">{{ $product->getTranslation('name') }}</a>
  158. </h3>
  159. </div>
  160. </div>
  161. </div>
  162. @endforeach
  163. </div>
  164. </div>
  165. </div>
  166. @endsection
  167. @section('script')
  168. <script type="text/javascript">
  169. AIZ.plugins.chart('#pie-1',{
  170. type: 'doughnut',
  171. data: {
  172. labels: [
  173. '{{translate('Total published products')}}',
  174. '{{translate('Total sellers products')}}',
  175. '{{translate('Total admin products')}}'
  176. ],
  177. datasets: [
  178. {
  179. data: [
  180. {{ \App\Models\Product::where('published', 1)->count() }},
  181. {{ \App\Models\Product::where('published', 1)->where('added_by', 'seller')->count() }},
  182. {{ \App\Models\Product::where('published', 1)->where('added_by', 'admin')->count() }}
  183. ],
  184. backgroundColor: [
  185. "#fd3995",
  186. "#34bfa3",
  187. "#5d78ff",
  188. '#fdcb6e',
  189. '#d35400',
  190. '#8e44ad',
  191. '#006442',
  192. '#4D8FAC',
  193. '#CA6924',
  194. '#C91F37'
  195. ]
  196. }
  197. ]
  198. },
  199. options: {
  200. cutoutPercentage: 70,
  201. legend: {
  202. labels: {
  203. fontFamily: 'Poppins',
  204. boxWidth: 10,
  205. usePointStyle: true
  206. },
  207. onClick: function () {
  208. return '';
  209. },
  210. position: 'bottom'
  211. }
  212. }
  213. });
  214. AIZ.plugins.chart('#pie-2',{
  215. type: 'doughnut',
  216. data: {
  217. labels: [
  218. '{{translate('Total sellers')}}',
  219. '{{translate('Total approved sellers')}}',
  220. '{{translate('Total pending sellers')}}'
  221. ],
  222. datasets: [
  223. {
  224. data: [
  225. {{ \App\Models\Shop::count() }},
  226. {{ \App\Models\Shop::where('verification_status', 1)->count() }},
  227. {{ \App\Models\Shop::where('verification_status', 0)->count() }}
  228. ],
  229. backgroundColor: [
  230. "#fd3995",
  231. "#34bfa3",
  232. "#5d78ff",
  233. '#fdcb6e',
  234. '#d35400',
  235. '#8e44ad',
  236. '#006442',
  237. '#4D8FAC',
  238. '#CA6924',
  239. '#C91F37'
  240. ]
  241. }
  242. ]
  243. },
  244. options: {
  245. cutoutPercentage: 70,
  246. legend: {
  247. labels: {
  248. fontFamily: 'Montserrat',
  249. boxWidth: 10,
  250. usePointStyle: true
  251. },
  252. onClick: function () {
  253. return '';
  254. },
  255. position: 'bottom'
  256. }
  257. }
  258. });
  259. AIZ.plugins.chart('#graph-1',{
  260. type: 'bar',
  261. data: {
  262. labels: [
  263. @foreach ($root_categories as $key => $category)
  264. '{{ $category->getTranslation('name') }}',
  265. @endforeach
  266. ],
  267. datasets: [{
  268. label: '{{ translate('Number of sale') }}',
  269. data: [
  270. {{ $cached_graph_data['num_of_sale_data'] }}
  271. ],
  272. backgroundColor: [
  273. @foreach ($root_categories as $key => $category)
  274. 'rgba(55, 125, 255, 0.4)',
  275. @endforeach
  276. ],
  277. borderColor: [
  278. @foreach ($root_categories as $key => $category)
  279. 'rgba(55, 125, 255, 1)',
  280. @endforeach
  281. ],
  282. borderWidth: 1
  283. }]
  284. },
  285. options: {
  286. scales: {
  287. yAxes: [{
  288. gridLines: {
  289. color: '#f2f3f8',
  290. zeroLineColor: '#f2f3f8'
  291. },
  292. ticks: {
  293. fontColor: "#8b8b8b",
  294. fontFamily: 'Poppins',
  295. fontSize: 10,
  296. beginAtZero: true
  297. }
  298. }],
  299. xAxes: [{
  300. gridLines: {
  301. color: '#f2f3f8'
  302. },
  303. ticks: {
  304. fontColor: "#8b8b8b",
  305. fontFamily: 'Poppins',
  306. fontSize: 10
  307. }
  308. }]
  309. },
  310. legend:{
  311. labels: {
  312. fontFamily: 'Poppins',
  313. boxWidth: 10,
  314. usePointStyle: true
  315. },
  316. onClick: function () {
  317. return '';
  318. },
  319. }
  320. }
  321. });
  322. AIZ.plugins.chart('#graph-2',{
  323. type: 'bar',
  324. data: {
  325. labels: [
  326. @foreach ($root_categories as $key => $category)
  327. '{{ $category->getTranslation('name') }}',
  328. @endforeach
  329. ],
  330. datasets: [{
  331. label: '{{ translate('Number of Stock') }}',
  332. data: [
  333. {{ $cached_graph_data['qty_data'] }}
  334. ],
  335. backgroundColor: [
  336. @foreach ($root_categories as $key => $category)
  337. 'rgba(253, 57, 149, 0.4)',
  338. @endforeach
  339. ],
  340. borderColor: [
  341. @foreach ($root_categories as $key => $category)
  342. 'rgba(253, 57, 149, 1)',
  343. @endforeach
  344. ],
  345. borderWidth: 1
  346. }]
  347. },
  348. options: {
  349. scales: {
  350. yAxes: [{
  351. gridLines: {
  352. color: '#f2f3f8',
  353. zeroLineColor: '#f2f3f8'
  354. },
  355. ticks: {
  356. fontColor: "#8b8b8b",
  357. fontFamily: 'Poppins',
  358. fontSize: 10,
  359. beginAtZero: true
  360. }
  361. }],
  362. xAxes: [{
  363. gridLines: {
  364. color: '#f2f3f8'
  365. },
  366. ticks: {
  367. fontColor: "#8b8b8b",
  368. fontFamily: 'Poppins',
  369. fontSize: 10
  370. }
  371. }]
  372. },
  373. legend:{
  374. labels: {
  375. fontFamily: 'Poppins',
  376. boxWidth: 10,
  377. usePointStyle: true
  378. },
  379. onClick: function () {
  380. return '';
  381. },
  382. }
  383. }
  384. });
  385. </script>
  386. @endsection