+ @if ($field['type'] == 'depends')
+ @include('admin::configuration.dependent-field-type')
+ @else
+
+
+
+ {!! __($field['title']) . ( __($field['title']) ? '' : '') !!}
+
+ @if (
+ ! empty($field['channel_based'])
+ && $channels->count() > 1
+ )
+
+ {{ $currentChannel->name }}
+
+ @endif
+
+ @if (! empty($field['locale_based']))
+
+ {{ $currentLocale->name }}
+
+ @endif
+
+
+
+
+ @if ($field['type'] == 'text')
+
+
+
+
+ @elseif ($field['type'] == 'password')
+
+
+
+
+ @elseif ($field['type'] == 'number')
+
+
+
+
+ @elseif ($field['type'] == 'color')
+
+
+
+
+ @elseif ($field['type'] == 'textarea')
+
+
+
+
+ @elseif ($field['type'] == 'editor')
+
+
+
+
+ @elseif ($field['type'] == 'select')
+ @php $selectedOption = core()->getConfigData($nameKey, $currentChannel->code, $currentLocale->code) ?? ''; @endphp
+
+
+ @if (isset($field['repository']))
+ @foreach ($value as $key => $option)
+
+ @endforeach
+ @else
+ @foreach ($field['options'] as $option)
+ @php
+ $value = ! isset($option['value']) ? null : ( $value = ! $option['value'] ? 0 : $option['value'] );
+ @endphp
+
+
+ @endforeach
+ @endif
+
+
+
+ @elseif ($field['type'] == 'multiselect')
+ @php $selectedOption = core()->getConfigData($nameKey, $currentChannel->code, $currentLocale->code) ?? ''; @endphp
+
+
+
+
+
+
+
+ @elseif ($field['type'] == 'boolean')
+ @php
+ $selectedOption = core()->getConfigData($nameKey, $currentChannel->code, $currentLocale->code) ?? ($field['default_value'] ?? '');
+ @endphp
+
+
+
+
+
+ @elseif ($field['type'] == 'image')
+
+ @php
+ $src = Storage::url(core()->getConfigData($nameKey, $currentChannel->code, $currentLocale->code));
+ $result = core()->getConfigData($nameKey, $currentChannel->code, $currentLocale->code);
+ @endphp
+
+
+ @if ($result)
+
+
+
+ @endif
+
+
+
+
+
+ @if ($result)
+
+
+
+
+
+ @lang('admin::app.configuration.index.delete')
+
+
+ @endif
+
+ @elseif ($field['type'] == 'file')
+ @php
+ $result = core()->getConfigData($nameKey, $currentChannel->code, $currentLocale->code);
+ $src = explode("/", $result);
+ $path = end($src);
+ @endphp
+
+ @if ($result)
+
+
+
+ @endif
+
+
+
+
+ @if ($result)
+
+
+
+
+
+ @lang('admin::app.configuration.index.delete')
+
+
+ @endif
+
+
+ @elseif ($field['type'] == 'country')
+
+
+
+
+ @foreach (core()->countries() as $country)
+
+ @endforeach
+
+
+
+
+
+
+ @elseif ($field['type'] == 'state')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @endif
+
+ @endif
+
+ @if (isset($field['info']))
+
+ @endif
+
+
+
+
+
+
+@if ($field['type'] == 'country')
+ @pushOnce('scripts')
+
+
+
+
+
+
+
+ @endPushOnce
+@endif
\ No newline at end of file
diff --git a/packages/Webkul/UpsShipping/tailwind.config.js b/packages/Webkul/UpsShipping/tailwind.config.js
new file mode 100644
index 0000000..56c3a70
--- /dev/null
+++ b/packages/Webkul/UpsShipping/tailwind.config.js
@@ -0,0 +1,10 @@
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ content: ["./src/Resources/**/*.blade.php", "./src/Resources/**/*.js"],
+
+ theme: {
+ extend: {},
+ },
+
+ plugins: [],
+};
\ No newline at end of file
diff --git a/packages/Webkul/UpsShipping/vite.config.js b/packages/Webkul/UpsShipping/vite.config.js
new file mode 100644
index 0000000..6f038dc
--- /dev/null
+++ b/packages/Webkul/UpsShipping/vite.config.js
@@ -0,0 +1,43 @@
+import { defineConfig, loadEnv } from "vite";
+import laravel from "laravel-vite-plugin";
+import path from "path";
+
+export default defineConfig(({ mode }) => {
+ const envDir = "../../../";
+
+ Object.assign(process.env, loadEnv(mode, envDir));
+
+ return {
+ build: {
+ emptyOutDir: true,
+ },
+
+ envDir,
+
+ server: {
+ host: process.env.VITE_HOST || "localhost",
+ port: process.env.VITE_PORT || 5173,
+ },
+
+ plugins: [
+ laravel({
+ hotFile: "../../../public/ups-module-vite.hot",
+ publicDirectory: "../../../public",
+ buildDirectory: "themes/ups-module/build",
+ input: [
+ "src/Resources/assets/css/app.css",
+ "src/Resources/assets/js/app.js",
+ ],
+ refresh: true,
+ }),
+ ],
+
+ experimental: {
+ renderBuiltUrl(filename, { hostId, hostType, type }) {
+ if (hostType === "css") {
+ return path.basename(filename);
+ }
+ },
+ },
+ };
+});
\ No newline at end of file
diff --git a/src/Carriers/Ups.php b/src/Carriers/Ups.php
deleted file mode 100644
index 7419e86..0000000
--- a/src/Carriers/Ups.php
+++ /dev/null
@@ -1,94 +0,0 @@
-getConfigData('sales.carriers.ups.active'))
- return false;
-
- $shippingMethods = [];
- $rates = [];
- $shippingHelper = app('Webkul\UpsShipping\Helpers\ShippingMethodHelper');
- $getCommonServices = app('Webkul\UpsShipping\Repositories\UpsRepository');
- $data = $shippingHelper->getAllCartProducts();
- $serviceData = $getCommonServices->getCommonMethods($data['response']);
-
- $shippingRate = session()->get('shipping_rates');
-
- if ( isset($data['response']) && $data['response'] && !$data['errorResponse'] && !empty($serviceData) ) {
- foreach ($serviceData as $key => $upsServices) {
- $rate = 0;
- $totalShippingCost = 0;
- $upsMethod = $key;
- $classId = '';
-
- foreach ($upsServices as $upsRate) {
- $classId = $upsRate['classId'];
- $rate += $upsRate['rate'] * $upsRate['itemQuantity'];
- $itemShippingCost = $upsRate['rate'] * $upsRate['itemQuantity'];
-
- if ( isset($rates[$key]) ) {
- $rates[$key] = [
- 'amount' => core()->convertPrice($rates[$key]['amount'] + $itemShippingCost),
- 'base_amount' => $rates[$key]['base_amount'] + $itemShippingCost
- ];
- } else {
- $rates[$key] = [
- 'amount' => core()->convertPrice($itemShippingCost),
- 'base_amount' => $itemShippingCost
- ];
- }
-
- $totalShippingCost += $itemShippingCost;
- }
-
- $object = new CartShippingRate;
- $object->carrier = 'ups';
- $object->carrier_title = $this->getConfigData('title') . ' (' . $this->getConfigData('description') . ')';
- $object->method = 'ups_' . $classId;
- $object->method_title = $upsMethod;
- $object->method_description = $this->getConfigData('title') . ' (' . $this->getConfigData('description') . ')';
- $object->is_calculate_tax = $this->getConfigData('is_calculate_tax');
- $object->price = core()->convertPrice($totalShippingCost);
- $object->base_price = $totalShippingCost;
-
- $shippingRate = session()->get('shipping_rates');
-
- if (! is_array($shippingRate)) {
- $shippingRates['ups'] = $rates;
- session()->put('shipping_rates', $shippingRates);
- } else {
- session()->put('shipping_rates.ups', $rates);
- }
-
- array_push($shippingMethods, $object);
- }
-
- return $shippingMethods;
- } else {
- return null;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Config/carriers.php b/src/Config/carriers.php
deleted file mode 100644
index 515b479..0000000
--- a/src/Config/carriers.php
+++ /dev/null
@@ -1,11 +0,0 @@
- [
- 'code' => 'ups',
- 'title' => 'UPS Shipping',
- 'description' => 'UPS Shipping',
- 'active' => true,
- 'class' => 'Webkul\UpsShipping\Carriers\Ups',
- ]
-];
\ No newline at end of file
diff --git a/src/Config/system.php b/src/Config/system.php
deleted file mode 100644
index a876108..0000000
--- a/src/Config/system.php
+++ /dev/null
@@ -1,151 +0,0 @@
- 'sales.carriers.ups',
- 'name' => 'ups::app.admin.system.ups',
- 'sort' => 3,
- 'fields' => [
- [
- 'name' => 'title',
- 'title' => 'ups::app.admin.system.title',
- 'type' => 'depends',
- 'depend' => 'active:1',
- 'validation' => 'required_if:active,1',
- 'channel_based' => true,
- 'locale_based' => true
- ], [
- 'name' => 'description',
- 'title' => 'ups::app.admin.system.description',
- 'type' => 'textarea',
- 'channel_based' => true,
- 'locale_based' => true
- ], [
- 'name' => 'active',
- 'title' => 'ups::app.admin.system.status',
- 'type' => 'boolean',
- 'validation' => 'required',
- 'channel_based' => true,
- 'locale_based' => false
- ], [
- 'name' => 'is_calculate_tax',
- 'title' => 'admin::app.admin.system.calculate-tax',
- 'type' => 'boolean',
- 'validation' => 'required',
- 'channel_based' => true,
- 'locale_based' => false,
- ], [
- 'name' => 'access_license_key',
- 'title' => 'ups::app.admin.system.access-license-number',
- 'type' => 'text',
- 'validation' => 'required',
- 'channel_based' => true,
- 'locale_based' => false
- ], [
- 'name' => 'user_id',
- 'title' => 'ups::app.admin.system.user-id',
- 'type' => 'text',
- 'validation' => 'required',
- 'channel_based' => true,
- 'locale_based' => false
- ], [
- 'name' => 'password',
- 'title' => 'ups::app.admin.system.password',
- 'type' => 'password',
- 'validation' => 'required',
- 'channel_based' => true,
- 'locale_based' => false
- ], [
- 'name' => 'shipper_number',
- 'title' => 'ups::app.admin.system.shipper',
- 'type' => 'text',
- 'channel_based' => true,
- 'locale_based' => false
- ], [
- 'name' => 'container',
- 'title' => 'ups::app.admin.system.container',
- 'type' => 'select',
- 'validation' => 'required',
- 'options' => [
- [
- 'title' => 'Package',
- 'value' => '02',
- ], [
- 'title' => 'UPS Letter',
- 'value' => '01'
- ], [
- 'title' => 'UPS Tube',
- 'value' => '03'
- ], [
- 'title' => 'UPS Pak',
- 'value' => '04'
- ], [
- 'title' => 'UPS Express Box',
- 'value' => '21'
- ]
- ],
- 'channel_based' => true,
- 'locale_based' => false
- ], [
- 'name' => 'weight_unit',
- 'title' => 'ups::app.admin.system.weight-unit',
- 'type' => 'select',
- 'validation' => 'required',
- 'options' => [
- [
- 'title' => 'LBS',
- 'value' => 'LBS'
- ], [
- 'title' => 'KGS',
- 'value' => 'KGS',
- ]
- ],
- 'channel_based' => true,
- 'locale_based' => false
- ], [
- 'name' => 'services',
- 'title' => 'ups::app.admin.system.allowed-methods',
- 'type' => 'multiselect',
- 'options' => [
- [
- 'title' => 'Next Day Air Early AM',
- 'value' => '14',
- ], [
- 'title' => 'Next Day Air',
- 'value' => '01'
- ], [
- 'title' => 'Next Day Air Saver',
- 'value' => '13'
- ], [
- 'title' => '2nd Day Air AM',
- 'value' => '59'
- ], [
- 'title' => '2nd Day Air',
- 'value' => '02'
- ], [
- 'title' => '3 Day Select',
- 'value' => '12'
- ], [
- 'title' => 'Ups Ground',
- 'value' => '03'
- ], [
- 'title' => 'UPS Worldwide Express',
- 'value' => '07'
- ], [
- 'title' => 'UPS Worldwide Express Plus',
- 'value' => '54'
- ], [
- 'title' => 'UPS Worldwide Expedited',
- 'value' => '08'
- ], [
- 'title' => 'UPS World Wide Saver',
- 'value' => '65'
- ],
-
- ],
- 'channel_based' => true,
- 'locale_based' => false
- ]
- ]
- ],
-];
\ No newline at end of file
diff --git a/src/Helpers/ShippingMethodHelper.php b/src/Helpers/ShippingMethodHelper.php
deleted file mode 100644
index 13e2bb4..0000000
--- a/src/Helpers/ShippingMethodHelper.php
+++ /dev/null
@@ -1,368 +0,0 @@
- 'Next Day Air',
- '02' => '2nd Day Air',
- '03' => 'Ups Ground',
- '07' => 'Ups Worldwide Express',
- '08' => 'Ups Worldwide Expedited',
- '11' => 'Standard',
- '12' => '3 Day Select',
- '13' => 'Next Day Air Saver',
- '14' => 'Next Day Air Early A.M.',
- '54' => 'Ups Worldwide Express Plus',
- '59' => '2nd Day Air A.M.',
- '65' => 'UPS World Wide Saver',
- '82' => 'Today Standard',
- '83' => 'Today Dedicated Courier',
- '84' => 'Today Intercity',
- '85' => 'Today Express',
- '86' => 'Today Express Saver'
- ];
-
- /**
- * Cart Address Object
- *
- * @var object
- */
- protected $cartAddress;
-
- /**
- * Ups Repository Object
- *
- * @var object
- */
- protected $upsRepository;
-
- /**
- * RateServiceWsdl
- *
- * @var string
- */
- protected $rateServiceWsdl;
-
- /**
- * ShipServiceWsdl
- *
- * @var string
- */
- protected $shipServiceWsdl;
-
- /**
- * SellerRepository object
- *
- * @var object
- */
- protected $channel;
-
-
- /**
- * Create a new controller instance.
- *
- * @param \Webkul\Checkout\Repositories\CartAddressRepository $cartAddress;
- * @param \Webkul\Core\Repositories\ChannelRepository $channel
- * @param \Webkul\Shipping\Repositories\UpsRepository $upsRepository;
- */
- public function __construct(
- CartAddress $cartAddress,
- UpsRepository $upsRepository,
- Channel $channel
- )
- {
- $this->_config = request('_config');
-
- $this->cartAddress = $cartAddress;
-
- $this->upsRepository = $upsRepository;
-
- $this->channel = $channel;
- }
-
- /**
- * display methods
- *
- * @return array
- */
- public function getAllCartProducts()
- {
- return $this->_createSoapClient()
- ;
- }
-
- /**
- * Soap client for wsdl
- *
- * @param string $wsdl
- * @param bool|int $trace
- * @return \SoapClient
- */
- protected function _createSoapClient()
- {
- $allServices = [];
- $errorResponse = [];
- $cart = Cart::getCart();
- $address = $cart->shipping_address;
- $channelDetails = $this->channel->findOneWhere(['code' => core()->getCurrentChannelCode()]);
- $sellerAdminServices = explode(",", core()->getConfigData('sales.carriers.ups.services'));
-
- foreach ($cart->items()->get() as $cartProduct) {
- if ($cartProduct->product->getTypeInstance()->isStockable()) {
- $weight = $this->getWeight($cartProduct->weight);
- $countryId = core()->getConfigData('sales.shipping.origin.country');
- $zoneInformation = core()->getConfigData('sales.shipping.origin.state');
- $address1 = core()->getConfigData('sales.shipping.origin.address1');
- $city = core()->getConfigData('sales.shipping.origin.city');
- $accessKey = core()->getConfigData('sales.carriers.ups.access_license_key');
- $userId = core()->getConfigData('sales.carriers.ups.user_id');
- $password = core()->getConfigData('sales.carriers.ups.password');
- $url = core()->getConfigData('sales.carriers.ups.gateway_url');
- $shipperNumber = core()->getConfigData('sales.carriers.ups.shipper_number');
- $shipperNumber = $shipperNumber ? $shipperNumber: '';
-
- // create a simple xml object for AccessRequest & RateRequest
- $accessRequesttXML = new \SimpleXMLElement ( "