From c0668bc889c9d377bbed4c063c1ebd6e6725bc81 Mon Sep 17 00:00:00 2001 From: HUNG HUYNH BA MANH Date: Thu, 15 Oct 2020 11:18:32 +0700 Subject: [PATCH] Feat (tracking): Create tracking page in Shop Interface - Create tracking page - Update readme - Add link to tracking page on order page see #5 --- README.md | 12 +- package.json | 30 ++++ publishable/assets/css/shipping.css | 1 + publishable/assets/icomoon/icomoon.eot | Bin 0 -> 1568 bytes publishable/assets/icomoon/icomoon.svg | 11 ++ publishable/assets/icomoon/icomoon.ttf | Bin 0 -> 1404 bytes publishable/assets/icomoon/icomoon.woff | Bin 0 -> 1480 bytes publishable/assets/icomoon/selection.json | 1 + publishable/assets/js/shipping.js | 1 + publishable/assets/mix-manifest.json | 4 + .../Controllers/Admin/TrackingController.php | 3 + .../Controllers/Shop/TrackingController.php | 48 ++++++ src/Http/routes.php | 21 ++- src/Providers/EventServiceProvider.php | 25 +++ src/Providers/ShippingServiceProvider.php | 6 + src/Resources/assets/icomoon/icomoon.eot | Bin 0 -> 1568 bytes src/Resources/assets/icomoon/icomoon.svg | 11 ++ src/Resources/assets/icomoon/icomoon.ttf | Bin 0 -> 1404 bytes src/Resources/assets/icomoon/icomoon.woff | Bin 0 -> 1480 bytes src/Resources/assets/icomoon/selection.json | 1 + src/Resources/assets/js/app.js | 9 ++ src/Resources/assets/sass/_font.scss | 30 ++++ src/Resources/assets/sass/app.scss | 100 ++++++++++++ src/Resources/lang/en/usps.php | 3 + .../views/{ => admin}/tracking/view.blade.php | 2 +- src/Resources/views/shop/script.blade.php | 1 + src/Resources/views/shop/style.blade.php | 1 + .../views/shop/tracking/view.blade.php | 146 ++++++++++++++++++ webpack.mix.js | 32 ++++ 29 files changed, 494 insertions(+), 5 deletions(-) create mode 100644 package.json create mode 100644 publishable/assets/css/shipping.css create mode 100644 publishable/assets/icomoon/icomoon.eot create mode 100644 publishable/assets/icomoon/icomoon.svg create mode 100644 publishable/assets/icomoon/icomoon.ttf create mode 100644 publishable/assets/icomoon/icomoon.woff create mode 100644 publishable/assets/icomoon/selection.json create mode 100644 publishable/assets/js/shipping.js create mode 100644 publishable/assets/mix-manifest.json create mode 100644 src/Http/Controllers/Shop/TrackingController.php create mode 100644 src/Providers/EventServiceProvider.php create mode 100644 src/Resources/assets/icomoon/icomoon.eot create mode 100644 src/Resources/assets/icomoon/icomoon.svg create mode 100644 src/Resources/assets/icomoon/icomoon.ttf create mode 100644 src/Resources/assets/icomoon/icomoon.woff create mode 100644 src/Resources/assets/icomoon/selection.json create mode 100644 src/Resources/assets/js/app.js create mode 100644 src/Resources/assets/sass/_font.scss create mode 100644 src/Resources/assets/sass/app.scss rename src/Resources/views/{ => admin}/tracking/view.blade.php (99%) create mode 100644 src/Resources/views/shop/script.blade.php create mode 100644 src/Resources/views/shop/style.blade.php create mode 100644 src/Resources/views/shop/tracking/view.blade.php create mode 100644 webpack.mix.js diff --git a/README.md b/README.md index af63f91..88af7d5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ This extension used for calculating shipping rate with the USPS services. ## Features - Calculate shipping rate with USPS services. -- Track your shipment by tracking number. +- Track your shipment by tracking number in Admin Interface. +- Track your shipment by tracking number in Shop Interface. ## Requirements - [Bagisto v1.2](https://github.com/bagisto/bagisto) - [vinceg/usps-php-api](https://packagist.org/packages/vinceg/usps-php-api) @@ -20,6 +21,10 @@ composer dump-autoload 5. Go to `https:///admin/configuration/sales/carriers`. 6. Make sure that **Marketplace USPS** is active and press save. 7. Go to `https:///admin/configuration/sales/shipping` and add shipping address. +8. Run the following command +```php +php artisan vendor:publish --all +``` Your customers are now able to select the new shipping method. @@ -48,8 +53,11 @@ Your customers are now able to select the new shipping method. ## Guide -### Track your shipment by tracking number. +### Track your shipment by tracking number in Admin Interface. - Go to `https:///admin/sales/tracking/{tracking-number}`. +### Track your shipment by tracking number in Shop Interface. +- Go to `https:///customer/account/orders/{order-id}/tracking`. + ### Get shipment infomations - Use `uspsTrackById($trackingIds)` method to get shipment infomations with `trackingIds` are tracking number array. diff --git a/package.json b/package.json new file mode 100644 index 0000000..9cf8a14 --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "private": true, + "scripts": { + "dev": "npm run development", + "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "watch-poll": "cross-env npm run watch -- --watch-poll --progress", + "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", + "prod": "npm run production", + "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" + }, + "devDependencies": { + "axios": "^0.19.0", + "cross-env": "^6.0.3", + "jquery": "^3.4.1", + "laravel-mix": "^5.0.0", + "laravel-mix-merge-manifest": "^0.1.2", + "sass": "^1.24.4", + "sass-loader": "^8.0.0", + "vue": "^2.6.11", + "vue-template-compiler": "^2.6.11" + }, + "dependencies": { + "accounting": "^0.4.1", + "ez-plus": "^1.2.1", + "vee-validate": "^2.2.15", + "vue-flatpickr": "^2.3.0", + "vue-slider-component": "^3.1.0" + } +} diff --git a/publishable/assets/css/shipping.css b/publishable/assets/css/shipping.css new file mode 100644 index 0000000..25f7b96 --- /dev/null +++ b/publishable/assets/css/shipping.css @@ -0,0 +1 @@ +@charset "UTF-8";@font-face{font-family:icomoon;src:url(../icomoon/icomoon.eot?jtn91v);src:url(../icomoon/icomoon.eot?jtn91v#iefix) format("embedded-opentype"),url(../icomoon/icomoon.ttf?jtn91v) format("truetype"),url(../icomoon/icomoon.woff?jtn91v) format("woff"),url(../icomoon/icomoon.svg?jtn91v#icomoon) format("svg");font-weight:400;font-style:normal;font-display:block}[class*=" icon-"],[class^=icon-]{font-family:icomoon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-truck:before{content:"\E904"}.sale-container.tracking{display:flex;padding:20px;border:1px solid #ccc;margin-bottom:30px}.sale-container.tracking strong{display:block;font-weight:bolder}.sale-container.tracking .process-bar,.sale-container.tracking .tracking-info{width:50%;display:inline-block}.sale-container.tracking .tracking-info .box{margin-bottom:20px}.sale-container.tracking .tracking-info .box .box-title{font-size:17px;border-bottom:1px solid #eee;margin-bottom:12px}.sale-container.tracking .process-bar .events{margin-left:60px}.sale-container.tracking .process-bar .events li{display:flex}.sale-container.tracking .process-bar .events li.delivered{color:#f60}.sale-container.tracking .process-bar .time{width:150px;position:relative;color:#777;padding:0 24px}.sale-container.tracking .process-bar .time:after{content:"";position:absolute;z-index:2;right:0;top:0;transform:translateX(50%);border-radius:50%;background:#fff;border:1px solid #ccc;width:16px;height:16px}.sale-container.tracking .process-bar .time.checked:after{background:#21a179;border:1px solid #21a179}.sale-container.tracking .process-bar .address{padding:0 22px 22px;width:400px;position:relative}.sale-container.tracking .process-bar .address:before{content:"";position:absolute;z-index:1;left:0;height:100%;border-left:1px solid #ccc}.sale-container.tracking .process-bar .address.checked:before{border-left:1px solid #21a179}.main-container-wrapper .account-table-content .table tr td.actions a{padding:0 2px}.main-container-wrapper .account-table-content .table .icon-truck:before{font-size:22px;left:12px;position:relative}.main-container-wrapper .header-tracking{margin-top:30px} \ No newline at end of file diff --git a/publishable/assets/icomoon/icomoon.eot b/publishable/assets/icomoon/icomoon.eot new file mode 100644 index 0000000000000000000000000000000000000000..1405f7cdb6be52df9b3814ae392a9188d876e533 GIT binary patch literal 1568 zcmaJ>O>7%Q6#mBh6Wd`O$~sA9m$I?3yQQj0;@DmUks=gT3Q&Pe)e{olI>w1)dn3n@ zlBx$^;LuBr=%o^e9uNYAIC11)ap1(ELfm?>#Hr#+Pe9B!yPL+YB1W2d-}~l!^LBUM zK1&DgXn;Tj(?eh&B=g<})4bFMqh5M+`}sW}fnC($q0Q-`LqP&nG|P#o@;cSy|qto%Y>>R;Vy_YUI(^zU;?w!FFv z8-LONhW-m}_izsezM%gjeXHZP8xP)z{Z0ROp8wgNx8LJ)a%dmPeJBdV0Q|y{2a#XN z+zYJu6Gah|x``q9*wbSJc%mx9@emsdCpS+%zSLQA@w3T{7q}N#ru2Ok@*U%d@^T~O ztS9RD-|?6nV?!*)e=N!~CeIZRRLxCrERM<>zT{N*|J;nsp+c#_#CdGu25P+i0bigX zu855OvPdqxDOSttVl97ZCR-{lRxZh%(po;dl+owUB^Qb-^HOtB6j#fYVrYU0Et4;u zTPqirRu`z$vkHB>^pg701g<3YD@>Tp=rh^SWb*4`NuEOWD?EH&No$FyWtgVXH%ujx z?pw7%Kk?f6zGEL-w&U22or`Z?y}B9ycGfpJ+ll_OBLl=puA@{wpGxO);!`eZI$xVc z81Y>Ym@`cA(02OKgw~HJk*XdwjiC%()?(`0!$EGCT-=bUj;X5I&gDwwvYd`ROr*D% zrzXY64-NBpluyZYr?YRECvwxMIrb>357ih8?pdweepIS|Jona9%&L;b`k5S}Z1Rgfb> zTnl-HxEx}Y_#ng@yTN>jb@K0qIF1zV%34-qWD?v7aD=!SVug4;#47Qf5Nm8o{9FB4 zoqRRKajfC1-MZKIyv}rIyV>aO?|L0;rLcT + + +Generated by IcoMoon + + + + + + + \ No newline at end of file diff --git a/publishable/assets/icomoon/icomoon.ttf b/publishable/assets/icomoon/icomoon.ttf new file mode 100644 index 0000000000000000000000000000000000000000..cc47148fbeea1732f8fe192e6c527d2e9e0f5004 GIT binary patch literal 1404 zcmaJ>O=ufO6#i!aEXiHD>B@GH(sV6F$|fO-ZQ0V6)?kVWI3X0AkW(Sr$XnSUX^kv{ z9dgj6J>(LX<`U>3hf>;7dg`$U(L+x?l+s%-f}TRI&8dmiZ+18S0n-sP@B7~S-n?1O z+l2ryjy_b(eti4d{KPwYnVz3H>y5UzHNE!7V?dlEzti-#w`kucmp0LC?S1<4$ybla zcR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(w!3Q^^PEPYV_&`7P4MJH()w^*en z?O^euI482kDUq7EDCWwGV!m)@B)3qSteoMQh515mI%|xdNKKSx$2sP-D9x2CrO1RC zdbY4|V!m9Oo|{0VkyGKrg_km>58+D6IER9{tTB>{Ot!Enrg;@ae~QJ&)r_8u*`{Tg zJ=0Q^OwX?F^pc;S?77aK?YOSvI{C!%`SZ((Uq+?LJ8tan1}BIC>p{9uNN4hSaT_WF z=ZR%T8NY^!dD9Y)9Jd!s>ODnO){K~C_BnM%k85A{ck=zzw{YlBlK{k(BZUwKY_P&ng%jMr~AZxfaaI_|0+q(qjiOh z3Tr69)rePt%MsRqw<4_LA7wnk2KcWdoS-z_#u>xF=unN2wVGa0Zgms!A zJHiI|wFoC@o*r-1f>sc;X@hDMPzw@J`>NmB+z8tCY;lIJl20AlL;xnR&MXya=E$rg z$u+;e)$}?j>SLo@cqkrqj*MIh+FiTuxBZUS_1Eod+xBWLxQx9OX+_rVqIw<6wB?RG Z>cXyryGGm4tMUMs!vkQC{PI6K{sn{%&>H{% literal 0 HcmV?d00001 diff --git a/publishable/assets/icomoon/selection.json b/publishable/assets/icomoon/selection.json new file mode 100644 index 0000000..35e4bde --- /dev/null +++ b/publishable/assets/icomoon/selection.json @@ -0,0 +1 @@ +{"IcoMoonType":"selection","icons":[{"icon":{"paths":["M794.624 366.24c-5.952-8.896-15.936-14.24-26.624-14.24h-32c-17.696 0-32 14.304-32 32v192c0 17.696 14.304 32 32 32h128c17.696 0 32-14.304 32-32v-48c0-6.304-1.888-12.512-5.376-17.76l-96-144zM864 576h-128v-192h32l96 144v48zM1007.872 490.752l-128-192c-17.856-26.784-47.744-42.752-79.872-42.752h-128v-64c0-52.928-43.072-96-96-96h-480c-52.928 0-96 43.072-96 96v352c0 52.928 43.072 96 96 96v0 96c0 52.928 43.072 96 96 96h36.544c14.304 55.072 64 96 123.488 96 59.424 0 109.12-40.928 123.424-96h169.024c14.304 55.072 64 96 123.488 96 59.424 0 109.12-40.928 123.424-96h36.608c52.928 0 96-43.072 96-96v-192c0-19.008-5.568-37.44-16.128-53.248zM96 576c-17.664 0-32-14.304-32-32v-352c0-17.696 14.336-32 32-32h480c17.696 0 32 14.304 32 32v352c0 17.696-14.304 32-32 32h-480zM352.032 864c-35.36 0-64-28.672-64-64s28.64-64 64-64c35.328 0 64 28.672 64 64s-28.704 64-64 64zM768 864c-35.36 0-64-28.672-64-64s28.64-64 64-64c35.328 0 64 28.672 64 64s-28.672 64-64 64zM960 736c0 17.696-14.304 32-32 32h-36.576c-14.304-55.072-64-96-123.424-96-59.488 0-109.184 40.928-123.488 96h-169.024c-14.304-55.072-64-96-123.424-96-59.488 0-109.184 40.928-123.488 96h-36.576c-17.664 0-32-14.304-32-32v-96h416c52.928 0 96-43.072 96-96v-224h128c10.688 0 20.672 5.344 26.624 14.24l128 192c3.488 5.248 5.376 11.456 5.376 17.76v192z"],"attrs":[{}],"isMulticolor":false,"isMulticolor2":false,"tags":["truck","transport","transaction","shipping"],"grid":32},"attrs":[{}],"properties":{"order":8,"id":0,"prevSize":32,"code":59652,"name":"truck"},"setIdx":0,"setId":2,"iconIdx":0}],"height":1024,"metadata":{"name":"icomoon"},"preferences":{"showGlyphs":true,"showCodes":true,"showQuickUse":true,"showQuickUse2":true,"showSVGs":true,"fontPref":{"prefix":"icon-","metadata":{"fontFamily":"icomoon"},"metrics":{"emSize":1024,"baseline":6.25,"whitespace":50},"embed":false},"imagePref":{"prefix":"icon-","png":true,"useClassSelector":true,"color":0,"bgColor":16777215,"name":"icomoon","classSelector":".icon"},"historySize":50,"gridSize":16,"showGrid":true}} \ No newline at end of file diff --git a/publishable/assets/js/shipping.js b/publishable/assets/js/shipping.js new file mode 100644 index 0000000..cd03d44 --- /dev/null +++ b/publishable/assets/js/shipping.js @@ -0,0 +1 @@ +!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=0)}({0:function(t,e,n){n("uPOf"),t.exports=n("w/dW")},uPOf:function(t,e){$((function(){$(".account-items-list table tbody tr").each((function(){var t=$(this).find("td:nth-child(1)").text(),e=$(this).find("td span.badge").text(),n=window.location.origin+"/customer/account/orders/"+t+"/tracking";"Completed"==e&&$(this).find("td.actions a").after('')}))}))},"w/dW":function(t,e){}}); \ No newline at end of file diff --git a/publishable/assets/mix-manifest.json b/publishable/assets/mix-manifest.json new file mode 100644 index 0000000..6c7027d --- /dev/null +++ b/publishable/assets/mix-manifest.json @@ -0,0 +1,4 @@ +{ + "/js/shipping.js": "/js/shipping.js?id=bf58a857d1dc0b9196b6", + "/css/shipping.css": "/css/shipping.css?id=de79e44769cc7a39975c" +} diff --git a/src/Http/Controllers/Admin/TrackingController.php b/src/Http/Controllers/Admin/TrackingController.php index 436df18..efce9c4 100644 --- a/src/Http/Controllers/Admin/TrackingController.php +++ b/src/Http/Controllers/Admin/TrackingController.php @@ -35,6 +35,9 @@ public function view($trackingId) { $trackings = uspsTrackById([$trackingId]); + if (! empty($trackings['message'])) + $trackings['message'] = str_replace('®', '', $trackings['message']); + return view($this->_config['view'], compact('trackings', 'trackingId')); } } diff --git a/src/Http/Controllers/Shop/TrackingController.php b/src/Http/Controllers/Shop/TrackingController.php new file mode 100644 index 0000000..9f0bccf --- /dev/null +++ b/src/Http/Controllers/Shop/TrackingController.php @@ -0,0 +1,48 @@ +middleware('customer'); + + $this->orderRepository = $orderRepository; + + parent::__construct(); + } + + /** + * Show the view for the specified resource. + * + * @param int $orderId + * @return \Illuminate\View\View + */ + public function view($orderId) + { + $order = $this->orderRepository->findOrFail($orderId); + $shipments = $order->shipments()->get()->toArray(); + $trackings = $shipments ? uspsTrackById(array_column($shipments, 'track_number')) : []; + + if (! empty($shipments) && count($shipments) == 1 && ! isset($trackings['status'])) + $trackings = [$trackings]; + + if (! empty($trackings['message'])) + $trackings['message'] = str_replace('®', '', $trackings['message']); + + return view($this->_config['view'], compact('trackings', 'order')); + } +} diff --git a/src/Http/routes.php b/src/Http/routes.php index 6c3412b..69eb44a 100644 --- a/src/Http/routes.php +++ b/src/Http/routes.php @@ -3,19 +3,36 @@ // Admin Routes Route::group(['middleware' => ['web']], function () { Route::prefix(config('app.admin_url'))->group(function () { - // Admin Routes Route::group(['namespace' => 'GGPHP\Shipping\Http\Controllers\Admin', 'middleware' => ['admin']], function () { // Sales Routes Route::prefix('sales')->group(function () { // Tracking Routes Route::get('tracking/{id}', 'TrackingController@view')->defaults('_config', [ - 'view' => 'ggphp-shipping::tracking.view', + 'view' => 'ggphp-shipping::admin.tracking.view', ]); }); }); }); }); +// Shop Routes +Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function () { + Route::namespace('GGPHP\Shipping\Http\Controllers\Shop')->group(function () { + // Customer routes + Route::prefix('customer')->group(function () { + // Auth Routes + Route::group(['middleware' => ['customer']], function () { + // Customer account + Route::prefix('account')->group(function () { + Route::get('orders/{id}/tracking', 'TrackingController@view')->defaults('_config', [ + 'view' => 'ggphp-shipping::shop.tracking.view' + ])->name('customer.orders.tracking'); + }); + }); + }); + }); +}); + // API Routes Route::group(['prefix' => 'api'], function ($router) { Route::group(['namespace' => 'GGPHP\Shipping\Http\Controllers\API', diff --git a/src/Providers/EventServiceProvider.php b/src/Providers/EventServiceProvider.php new file mode 100644 index 0000000..751f83e --- /dev/null +++ b/src/Providers/EventServiceProvider.php @@ -0,0 +1,25 @@ +addTemplate('ggphp-shipping::shop.style'); + }); + + Event::listen(['bagisto.shop.layout.body.after'], function($viewRenderEventManager) { + $viewRenderEventManager->addTemplate('ggphp-shipping::shop.script'); + }); + } +} diff --git a/src/Providers/ShippingServiceProvider.php b/src/Providers/ShippingServiceProvider.php index 63c4a1a..60c3493 100644 --- a/src/Providers/ShippingServiceProvider.php +++ b/src/Providers/ShippingServiceProvider.php @@ -13,12 +13,18 @@ class ShippingServiceProvider extends ServiceProvider */ public function boot() { + $this->publishes([ + __DIR__ . '/../../publishable/assets' => public_path('vendor/ggphp/shipping/assets'), + ], 'public'); + $this->loadRoutesFrom(__DIR__ . '/../Http/routes.php'); $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'ggphp'); $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'ggphp-shipping'); + $this->app->register(EventServiceProvider::class); + $this->app->register(USPSServiceProvider::class); } } diff --git a/src/Resources/assets/icomoon/icomoon.eot b/src/Resources/assets/icomoon/icomoon.eot new file mode 100644 index 0000000000000000000000000000000000000000..1405f7cdb6be52df9b3814ae392a9188d876e533 GIT binary patch literal 1568 zcmaJ>O>7%Q6#mBh6Wd`O$~sA9m$I?3yQQj0;@DmUks=gT3Q&Pe)e{olI>w1)dn3n@ zlBx$^;LuBr=%o^e9uNYAIC11)ap1(ELfm?>#Hr#+Pe9B!yPL+YB1W2d-}~l!^LBUM zK1&DgXn;Tj(?eh&B=g<})4bFMqh5M+`}sW}fnC($q0Q-`LqP&nG|P#o@;cSy|qto%Y>>R;Vy_YUI(^zU;?w!FFv z8-LONhW-m}_izsezM%gjeXHZP8xP)z{Z0ROp8wgNx8LJ)a%dmPeJBdV0Q|y{2a#XN z+zYJu6Gah|x``q9*wbSJc%mx9@emsdCpS+%zSLQA@w3T{7q}N#ru2Ok@*U%d@^T~O ztS9RD-|?6nV?!*)e=N!~CeIZRRLxCrERM<>zT{N*|J;nsp+c#_#CdGu25P+i0bigX zu855OvPdqxDOSttVl97ZCR-{lRxZh%(po;dl+owUB^Qb-^HOtB6j#fYVrYU0Et4;u zTPqirRu`z$vkHB>^pg701g<3YD@>Tp=rh^SWb*4`NuEOWD?EH&No$FyWtgVXH%ujx z?pw7%Kk?f6zGEL-w&U22or`Z?y}B9ycGfpJ+ll_OBLl=puA@{wpGxO);!`eZI$xVc z81Y>Ym@`cA(02OKgw~HJk*XdwjiC%()?(`0!$EGCT-=bUj;X5I&gDwwvYd`ROr*D% zrzXY64-NBpluyZYr?YRECvwxMIrb>357ih8?pdweepIS|Jona9%&L;b`k5S}Z1Rgfb> zTnl-HxEx}Y_#ng@yTN>jb@K0qIF1zV%34-qWD?v7aD=!SVug4;#47Qf5Nm8o{9FB4 zoqRRKajfC1-MZKIyv}rIyV>aO?|L0;rLcT + + +Generated by IcoMoon + + + + + + + \ No newline at end of file diff --git a/src/Resources/assets/icomoon/icomoon.ttf b/src/Resources/assets/icomoon/icomoon.ttf new file mode 100644 index 0000000000000000000000000000000000000000..cc47148fbeea1732f8fe192e6c527d2e9e0f5004 GIT binary patch literal 1404 zcmaJ>O=ufO6#i!aEXiHD>B@GH(sV6F$|fO-ZQ0V6)?kVWI3X0AkW(Sr$XnSUX^kv{ z9dgj6J>(LX<`U>3hf>;7dg`$U(L+x?l+s%-f}TRI&8dmiZ+18S0n-sP@B7~S-n?1O z+l2ryjy_b(eti4d{KPwYnVz3H>y5UzHNE!7V?dlEzti-#w`kucmp0LC?S1<4$ybla zcR2?ezPFy;X*B@VWxTpU$Jj6GujEpHVWZvKO%aek;gV?u4G#|fA^(>At+uzj1ruMA z|3q$gyte=JM)F_sKe_+sTfugZ=j6~ok#VRh#6EODd8+(I&*R977pRD&)Eygw$38ih zf#;e!7!9zjaxy6Yi#Nj#fvhIyImRN(k|Eb1pD~356#fM4=i2D?Xha_lu^9b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I{C!%`SZ((Uq+?LJ8tan1}BIC>p{9uNN4hSaT_WF z=ZR%T8NY^!dD9Y)9Jd!s>ODnO){K~C_BnM%k85A{ck=zzw{YlBlK{k(BZUwKY_P&ng%jMr~AZxfaaI_|0+q(qjiOh z3Tr69)rePt%MsRqw<4_LA7wnk2KcWdoS-z_#u>xF=unN2wVGa0Zgms!A zJHiI|wFoC@o*r-1f>sc;X@hDMPzw@J`>NmB+z8tCY;lIJl20AlL;xnR&MXya=E$rg z$u+;e)$}?j>SLo@cqkrqj*MIh+FiTuxBZUS_1Eod+xBWLxQx9OX+_rVqIw<6wB?RG Z>cXyryGGm4tMUMs!vkQC{PI6K{sn{%&>H{% literal 0 HcmV?d00001 diff --git a/src/Resources/assets/icomoon/selection.json b/src/Resources/assets/icomoon/selection.json new file mode 100644 index 0000000..35e4bde --- /dev/null +++ b/src/Resources/assets/icomoon/selection.json @@ -0,0 +1 @@ +{"IcoMoonType":"selection","icons":[{"icon":{"paths":["M794.624 366.24c-5.952-8.896-15.936-14.24-26.624-14.24h-32c-17.696 0-32 14.304-32 32v192c0 17.696 14.304 32 32 32h128c17.696 0 32-14.304 32-32v-48c0-6.304-1.888-12.512-5.376-17.76l-96-144zM864 576h-128v-192h32l96 144v48zM1007.872 490.752l-128-192c-17.856-26.784-47.744-42.752-79.872-42.752h-128v-64c0-52.928-43.072-96-96-96h-480c-52.928 0-96 43.072-96 96v352c0 52.928 43.072 96 96 96v0 96c0 52.928 43.072 96 96 96h36.544c14.304 55.072 64 96 123.488 96 59.424 0 109.12-40.928 123.424-96h169.024c14.304 55.072 64 96 123.488 96 59.424 0 109.12-40.928 123.424-96h36.608c52.928 0 96-43.072 96-96v-192c0-19.008-5.568-37.44-16.128-53.248zM96 576c-17.664 0-32-14.304-32-32v-352c0-17.696 14.336-32 32-32h480c17.696 0 32 14.304 32 32v352c0 17.696-14.304 32-32 32h-480zM352.032 864c-35.36 0-64-28.672-64-64s28.64-64 64-64c35.328 0 64 28.672 64 64s-28.704 64-64 64zM768 864c-35.36 0-64-28.672-64-64s28.64-64 64-64c35.328 0 64 28.672 64 64s-28.672 64-64 64zM960 736c0 17.696-14.304 32-32 32h-36.576c-14.304-55.072-64-96-123.424-96-59.488 0-109.184 40.928-123.488 96h-169.024c-14.304-55.072-64-96-123.424-96-59.488 0-109.184 40.928-123.488 96h-36.576c-17.664 0-32-14.304-32-32v-96h416c52.928 0 96-43.072 96-96v-224h128c10.688 0 20.672 5.344 26.624 14.24l128 192c3.488 5.248 5.376 11.456 5.376 17.76v192z"],"attrs":[{}],"isMulticolor":false,"isMulticolor2":false,"tags":["truck","transport","transaction","shipping"],"grid":32},"attrs":[{}],"properties":{"order":8,"id":0,"prevSize":32,"code":59652,"name":"truck"},"setIdx":0,"setId":2,"iconIdx":0}],"height":1024,"metadata":{"name":"icomoon"},"preferences":{"showGlyphs":true,"showCodes":true,"showQuickUse":true,"showQuickUse2":true,"showSVGs":true,"fontPref":{"prefix":"icon-","metadata":{"fontFamily":"icomoon"},"metrics":{"emSize":1024,"baseline":6.25,"whitespace":50},"embed":false},"imagePref":{"prefix":"icon-","png":true,"useClassSelector":true,"color":0,"bgColor":16777215,"name":"icomoon","classSelector":".icon"},"historySize":50,"gridSize":16,"showGrid":true}} \ No newline at end of file diff --git a/src/Resources/assets/js/app.js b/src/Resources/assets/js/app.js new file mode 100644 index 0000000..b889685 --- /dev/null +++ b/src/Resources/assets/js/app.js @@ -0,0 +1,9 @@ +$(function() { + $('.account-items-list table tbody tr').each(function() { + var id = $(this).find('td:nth-child(1)').text(); + var status = $(this).find('td span.badge').text(); + var link = window.location.origin + '/customer/account/orders/' + id + '/tracking'; + if (status == 'Completed') + $(this).find('td.actions a').after(''); + }); +}); diff --git a/src/Resources/assets/sass/_font.scss b/src/Resources/assets/sass/_font.scss new file mode 100644 index 0000000..72a46fe --- /dev/null +++ b/src/Resources/assets/sass/_font.scss @@ -0,0 +1,30 @@ +@font-face { + font-family: 'icomoon'; + src: url('../icomoon/icomoon.eot?jtn91v'); + src: url('../icomoon/icomoon.eot?jtn91v#iefix') format('embedded-opentype'), + url('../icomoon/icomoon.ttf?jtn91v') format('truetype'), + url('../icomoon/icomoon.woff?jtn91v') format('woff'), + url('../icomoon/icomoon.svg?jtn91v#icomoon') format('svg'); + font-weight: normal; + font-style: normal; + font-display: block; +} + +[class^="icon-"], [class*=" icon-"] { + /* use !important to prevent issues with browser extensions that change fonts */ + font-family: 'icomoon' !important; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-truck:before { + content: "\e904"; +} diff --git a/src/Resources/assets/sass/app.scss b/src/Resources/assets/sass/app.scss new file mode 100644 index 0000000..a8b0324 --- /dev/null +++ b/src/Resources/assets/sass/app.scss @@ -0,0 +1,100 @@ +@import "font"; + +.sale-container.tracking { + display: flex; + padding: 20px; + border: 1px solid #ccc; + margin-bottom: 30px; + strong { + display: block; + font-weight: bolder; + } + .tracking-info, .process-bar { + width: 50%; + display: inline-block; + } + .tracking-info { + .box { + margin-bottom: 20px; + .box-title { + font-size: 17px; + border-bottom: 1px solid #eee; + margin-bottom: 12px; + } + } + } + .process-bar { + .events { + li { + display: flex; + &.delivered { + color: #ff6600; + } + } + margin-left: 60px; + } + .time { + width: 150px; + position: relative; + color: #777; + padding: 0 24px; + &::after { + content: ""; + position: absolute; + z-index: 2; + right: 0; + top: 0; + transform: translateX(50%); + border-radius: 50%; + background: #fff; + border: 1px #ccc solid; + width: 16px; + height: 16px; + } + &.checked::after { + background: #21a179; + border: 1px #21a179 solid; + } + } + .address { + padding: 0 22px 22px 22px; + width: 400px; + position: relative; + &::before { + content: ""; + position: absolute; + z-index: 1; + left: 0; + height: 100%; + border-left: 1px #ccc solid; + } + &.checked::before { + border-left: 1px #21a179 solid; + } + } + } +} + +.main-container-wrapper { + .account-table-content { + .table { + tr { + td.actions { + a { + padding: 0 2px; + } + } + } + .icon-truck { + &:before { + font-size: 22px; + left: 12px; + position: relative; + } + } + } + } + .header-tracking { + margin-top: 30px; + } +} diff --git a/src/Resources/lang/en/usps.php b/src/Resources/lang/en/usps.php index c8ed9fe..48482e0 100644 --- a/src/Resources/lang/en/usps.php +++ b/src/Resources/lang/en/usps.php @@ -18,6 +18,7 @@ 'production-mode' => 'Production Mode', 'first-class-mail-type' => 'First Class Mail Type', 'tracking-title' => 'Tracking', + 'trackings-title' => 'Trackings', 'tracking-detail' => 'Track Detail', 'event' => 'Event', 'date-time' => 'Date Time', @@ -27,6 +28,8 @@ 'zip-code' => 'ZIP Code', 'country' => 'Country', 'firm-name' => 'Firm Name', + 'tracking-id' => 'Tracking ID', + 'order-id' => 'Order ID', ] ] ]; diff --git a/src/Resources/views/tracking/view.blade.php b/src/Resources/views/admin/tracking/view.blade.php similarity index 99% rename from src/Resources/views/tracking/view.blade.php rename to src/Resources/views/admin/tracking/view.blade.php index 2a3947b..a649474 100644 --- a/src/Resources/views/tracking/view.blade.php +++ b/src/Resources/views/admin/tracking/view.blade.php @@ -184,7 +184,7 @@ @else
-

{{ $trackings['message'] }}

+

{{ str_replace( `®`, '', $trackings['message']) }}

@endif diff --git a/src/Resources/views/shop/script.blade.php b/src/Resources/views/shop/script.blade.php new file mode 100644 index 0000000..e0761c4 --- /dev/null +++ b/src/Resources/views/shop/script.blade.php @@ -0,0 +1 @@ + diff --git a/src/Resources/views/shop/style.blade.php b/src/Resources/views/shop/style.blade.php new file mode 100644 index 0000000..7426c82 --- /dev/null +++ b/src/Resources/views/shop/style.blade.php @@ -0,0 +1 @@ + diff --git a/src/Resources/views/shop/tracking/view.blade.php b/src/Resources/views/shop/tracking/view.blade.php new file mode 100644 index 0000000..83b6835 --- /dev/null +++ b/src/Resources/views/shop/tracking/view.blade.php @@ -0,0 +1,146 @@ +@extends('shop::layouts.master') + +@section('page_title') + {{ __('ggphp::usps.admin.system.trackings-title') }} +@stop + +@section('content-wrapper') + +
+
+
+

+ {{ __('ggphp::usps.admin.system.trackings-title') }} +

+
+
+ +
+ + @if (! empty($trackings) && ! isset($trackings['status'])) + @foreach ($trackings as $tracking) +
+
+
+ {{ __('ggphp::usps.admin.system.tracking-id') }}: + +
+ #{{ $tracking['@attributes']['ID'] ?? '' }} +
+
+ +
+ {{ __('ggphp::usps.admin.system.order-id') }}: + + +
+ +
+ + {{ __('shop::app.customer.account.order.view.billing-address') }} + + +
+ @include ('admin::sales.address', ['address' => $order->billing_address]) +
+
+ + @if ($order->shipping_address) +
+ + {{ __('shop::app.customer.account.order.view.shipping-address') }} + + +
+ @include ('admin::sales.address', ['address' => $order->shipping_address]) +
+
+ +
+ + {{ __('shop::app.customer.account.order.view.shipping-method') }} + + +
+ {{ $order->shipping_title ?? '' }} +
+
+ @endif + +
+ + {{ __('shop::app.customer.account.order.view.payment-method') }} + + +
+ {{ core()->getConfigData('sales.paymentmethods.' . $order->payment->method . '.title') }} + + @php $additionalDetails = \Webkul\Payment\Payment::getAdditionalDetails($order->payment->method); @endphp + + @if (! empty($additionalDetails)) +
+ +

{{ $additionalDetails['value'] }}

+
+ @endif +
+
+
+ +
+
    + + @if (! empty($tracking['TrackSummary'])) +
  • + {{ $tracking['TrackSummary']['EventDate'] . ' ' . $tracking['TrackSummary']['EventTime'] }} + + {{ $tracking['TrackSummary']['Event'] }} + {{ + $tracking['TrackSummary']['EventCity'] ?? '' . + ( $tracking['TrackSummary']['EventZIPCode'] ? (', ' . $tracking['TrackSummary']['EventZIPCode']) : '') . + ( $tracking['TrackSummary']['EventState'] ? (', ' . $tracking['TrackSummary']['EventState']) : '') . + ( $tracking['TrackSummary']['EventCountry'] ? (', ' . $tracking['TrackSummary']['EventCountry']) : '') + }} + +
  • + @else +
  • + + + Delivered + +
  • + @endif + + @foreach ($tracking['TrackDetail'] as $event) +
  • + {{ ($event['EventDate'] ?? '') . ' ' . ($event['EventTime'] ?? '') }} + + {{ $event['Event'] ?? '' }} + {{ + $event['EventCity'] ?? '' . + ($event['EventZIPCode'] ? (', ' . $event['EventZIPCode']) : '') . + ($event['EventState'] ? (', ' . $event['EventState']) : '') . + ($event['EventCountry'] ? (', ' . $event['EventCountry']) : '') + }} + +
  • + @endforeach +
+
+
+ @endforeach + @else +
+

{{ $trackings['message'] ?? '' }}

+
+ @endif + +
+
+ +@stop diff --git a/webpack.mix.js b/webpack.mix.js new file mode 100644 index 0000000..eb55375 --- /dev/null +++ b/webpack.mix.js @@ -0,0 +1,32 @@ +const mix = require("laravel-mix"); + +if (mix == 'undefined') { + const { mix } = require("laravel-mix"); +} + +require("laravel-mix-merge-manifest"); + +if (mix.inProduction()) { + var publicPath = 'publishable/assets'; +} else { + var publicPath = "../../../public/vendor/ggphp/shipping/assets"; +} + +mix.setPublicPath(publicPath).mergeManifest(); +mix.disableNotifications(); + +mix.sass(__dirname + '/src/Resources/assets/sass/app.scss', 'css/shipping.css') + .copyDirectory(__dirname + '/src/Resources/assets/icomoon', publicPath + '/icomoon') + .options({ + processCssUrls: false + }); + +mix.js([__dirname + '/src/Resources/assets/js/app.js'], 'js/shipping.js'); + +if (!mix.inProduction()) { + mix.sourceMaps(); +} + +if (mix.inProduction()) { + mix.version(); +}