Squashed All Commits

This commit is contained in:
Devansh 2022-02-01 16:44:16 +05:30
parent 37ab87e54c
commit c9b60b2c10
41 changed files with 2073 additions and 1203 deletions

View File

@ -1,6 +1,9 @@
<?php
return [
/**
* General.
*/
[
'key' => 'general',
'name' => 'admin::app.admin.system.general',
@ -27,7 +30,7 @@ return [
'value' => 'kgs',
],
],
'channel_based' => true
'channel_based' => true,
],
],
], [
@ -70,7 +73,7 @@ return [
'type' => 'textarea',
'channel_based' => true,
'locale_based' => false,
]
],
],
], [
'key' => 'general.design',
@ -95,7 +98,12 @@ return [
'validation' => 'mimes:bmp,jpeg,jpg,png,webp',
],
],
], [
],
/**
* Catalog.
*/
[
'key' => 'catalog',
'name' => 'admin::app.admin.system.catalog',
'sort' => 2,
@ -120,16 +128,16 @@ return [
'sort' => 2,
'fields' => [
[
'name' => 'no_of_new_product_homepage',
'title' => 'admin::app.admin.system.allow-no-of-new-product-homepage',
'type' => 'number',
'validation' => 'min:0',
'name' => 'no_of_new_product_homepage',
'title' => 'admin::app.admin.system.allow-no-of-new-product-homepage',
'type' => 'number',
'validation' => 'min:0',
],
[
'name' => 'no_of_featured_product_homepage',
'title' => 'admin::app.admin.system.allow-no-of-featured-product-homepage',
'type' => 'number',
'validation' => 'min:0',
'name' => 'no_of_featured_product_homepage',
'title' => 'admin::app.admin.system.allow-no-of-featured-product-homepage',
'type' => 'number',
'validation' => 'min:0',
],
[
'name' => 'out_of_stock_items',
@ -192,7 +200,7 @@ return [
'name' => 'buy_now_button_display',
'title' => 'admin::app.admin.system.buy-now-button-display',
'type' => 'boolean',
]
],
],
], [
'key' => 'catalog.products.cache-small-image',
@ -208,7 +216,7 @@ return [
'name' => 'height',
'title' => 'admin::app.admin.system.height',
'type' => 'text',
]
],
],
], [
'key' => 'catalog.products.cache-medium-image',
@ -224,7 +232,7 @@ return [
'name' => 'height',
'title' => 'admin::app.admin.system.height',
'type' => 'text',
]
],
],
], [
'key' => 'catalog.products.cache-large-image',
@ -240,7 +248,7 @@ return [
'name' => 'height',
'title' => 'admin::app.admin.system.height',
'type' => 'text',
]
],
],
], [
'key' => 'catalog.products.review',
@ -266,7 +274,7 @@ return [
'name' => 'file_attribute_upload_size',
'title' => 'admin::app.admin.system.file-upload-size',
'type' => 'text',
]
],
],
], [
'key' => 'catalog.inventory',
@ -340,16 +348,65 @@ return [
'name' => 'show_search_input_field',
'title' => 'admin::app.admin.system.show-search-input-field',
'type' => 'boolean',
]
]
], [
],
],
],
/**
* Customer.
*/
[
'key' => 'customer',
'name' => 'admin::app.admin.system.customer',
'sort' => 4,
'sort' => 3,
], [
'key' => 'customer.address',
'name' => 'admin::app.admin.system.address',
'sort' => 1,
], [
'key' => 'customer.address.requirements',
'name' => 'admin::app.admin.system.requirements',
'sort' => 1,
'fields' => [
[
'name' => 'country',
'title' => 'admin::app.admin.system.country',
'type' => 'boolean',
'channel_based' => true,
'default' => '1',
],
[
'name' => 'state',
'title' => 'admin::app.admin.system.state',
'type' => 'boolean',
'channel_based' => true,
'default' => '1',
],
[
'name' => 'postcode',
'title' => 'admin::app.admin.system.zip',
'type' => 'boolean',
'channel_based' => true,
'default' => '1',
],
],
], [
'key' => 'customer.address.information',
'name' => 'Information',
'sort' => 2,
'fields' => [
[
'name' => 'street_lines',
'title' => 'admin::app.admin.system.street-lines',
'type' => 'text',
'validation' => 'between:1,4',
'channel_based' => true,
],
],
], [
'key' => 'customer.settings',
'name' => 'admin::app.admin.system.settings',
'sort' => 1,
'sort' => 3,
], [
'key' => 'customer.settings.wishlist',
'name' => 'admin::app.admin.system.wishlist',
@ -361,23 +418,10 @@ return [
'type' => 'boolean',
],
],
], [
'key' => 'customer.settings.address',
'name' => 'admin::app.admin.system.address',
'sort' => 2,
'fields' => [
[
'name' => 'street_lines',
'title' => 'admin::app.admin.system.street-lines',
'type' => 'text',
'validation' => 'between:1,4',
'channel_based' => true,
],
],
], [
'key' => 'customer.settings.newsletter',
'name' => 'admin::app.admin.system.newsletter',
'sort' => 3,
'sort' => 2,
'fields' => [
[
'name' => 'subscription',
@ -388,7 +432,7 @@ return [
], [
'key' => 'customer.settings.email',
'name' => 'admin::app.admin.system.email',
'sort' => 4,
'sort' => 3,
'fields' => [
[
'name' => 'verification',
@ -396,10 +440,15 @@ return [
'type' => 'boolean',
],
],
], [
],
/**
* Emails.
*/
[
'key' => 'emails',
'name' => 'admin::app.admin.emails.email',
'sort' => 5,
'sort' => 4,
], [
'key' => 'emails.configure',
'name' => 'admin::app.admin.system.email-settings',
@ -417,7 +466,7 @@ return [
'validation' => 'required|max:50',
'channel_based' => true,
'default_value' => config('mail.from.name'),
], [
], [
'name' => 'shop_email_from',
'title' => 'admin::app.admin.system.shop-email-from',
'type' => 'text',
@ -425,7 +474,7 @@ return [
'validation' => 'required|email',
'channel_based' => true,
'default_value' => config('mail.from.address'),
], [
], [
'name' => 'admin_name',
'title' => 'admin::app.admin.system.admin-name',
'type' => 'text',
@ -433,7 +482,7 @@ return [
'validation' => 'required|max:50',
'channel_based' => true,
'default_value' => config('mail.admin.name'),
], [
], [
'name' => 'admin_email',
'title' => 'admin::app.admin.system.admin-email',
'type' => 'text',

View File

@ -1422,10 +1422,12 @@ return [
'flate-rate-shipping' => 'تعريفة موحدة للشحن بغض النظر عن الكمية',
'shipping' => 'الشحن',
'origin' => 'الأصل',
'requirements' => 'Requirements',
'country' => 'بلد',
'state' => 'حالة',
'zip' => 'الرمز البريدي',
'city' => 'مدينة',
'information' => 'Information',
'street-address' => 'عنوان الشارع',
'title' => 'عنوان',
'description' => 'وصف',

View File

@ -1430,10 +1430,12 @@ return [
'flate-rate-shipping' => 'Pauschale Versandkosten',
'shipping' => 'Versand',
'origin' => 'Herkunft',
'requirements' => 'Requirements',
'country' => 'Land',
'state' => 'Bundesland',
'zip' => 'Postleitzahl',
'city' => 'Stadt',
'information' => 'Information',
'street-address' => 'Anschrift',
'title' => 'Titel',
'description' => 'Beschreibung',

View File

@ -1421,7 +1421,8 @@ return [
],
],
'system' => [
'system' => [
'catalog' => 'Catalog',
'homepage' => 'Homepage configuration',
'allow-out-of-stock-items' => 'Allow out of stock items',
@ -1449,10 +1450,12 @@ return [
'flate-rate-shipping' => 'Flat Rate Shipping',
'shipping' => 'Shipping',
'origin' => 'Origin',
'requirements' => 'Requirements',
'country' => 'Country',
'state' => 'State',
'zip' => 'Zip',
'city' => 'City',
'information' => 'Information',
'street-address' => 'Street Address',
'title' => 'Title',
'description' => 'Description',

View File

@ -1434,10 +1434,12 @@ return [
'flate-rate-shipping' => 'Envío con tarifa plana',
'shipping' => 'Envío',
'origin' => 'Origen',
'requirements' => 'Requirements',
'country' => 'País',
'state' => 'Departamento',
'zip' => 'Código Postal',
'city' => 'Ciudad',
'information' => 'Information',
'street-address' => 'Dirección',
'title' => 'Título',
'description' => 'Descripción',

View File

@ -1419,10 +1419,12 @@ return [
'flate-rate-shipping' => 'نرخ ثابت حمل و نقل',
'shipping' => 'حمل و نقل دریایی',
'origin' => 'مبدا',
'requirements' => 'Requirements',
'country' => 'کشور',
'state' => 'استان',
'zip' => 'کد پستی',
'city' => 'شهر',
'information' => 'Information',
'street-address' => 'آدرس خیابان',
'title' => 'عنوان',
'description' => 'توضیحات',

View File

@ -1446,10 +1446,12 @@ return [
'flate-rate-shipping' => 'Expédition forfaitaire',
'shipping' => 'Expédition',
'origin' => 'Origine',
'requirements' => 'Requirements',
'country' => 'Pays',
'state' => 'État',
'zip' => 'Zipper',
'city' => 'Ville',
'information' => 'Information',
'street-address' => 'Adresse de rue',
'title' => 'Titre',
'description' => 'La description',

View File

@ -1422,10 +1422,12 @@ return [
'flate-rate-shipping' => 'Spedizione Prezzo Fisso',
'shipping' => 'Spedizione',
'origin' => 'Origine',
'requirements' => 'Requirements',
'country' => 'Paese',
'state' => 'Provincia',
'zip' => 'CAP',
'city' => 'Città',
'information' => 'Information',
'street-address' => 'Indirizzo',
'title' => 'Titolo',
'description' => 'Descrizione',

View File

@ -1416,10 +1416,12 @@ return [
'flate-rate-shipping' => 'Forfaitaire verzendkosten',
'shipping' => 'Verzending',
'origin' => 'Herkomst',
'requirements' => 'Requirements',
'country' => 'Land',
'state' => 'Staat/Provincie',
'zip' => 'Zip',
'city' => 'Woonplaats',
'information' => 'Information',
'street-address' => 'Adres',
'title' => 'Titel',
'description' => 'Omschrijving',

View File

@ -1419,10 +1419,12 @@ return [
'flate-rate-shipping' => 'Stawka ryczałtowa',
'shipping' => 'Dostawa',
'origin' => 'Zamieszmanie',
'requirements' => 'Requirements',
'country' => 'Kraj',
'state' => 'Stan/województwo',
'zip' => 'Kod',
'city' => 'Miasto',
'information' => 'Information',
'street-address' => 'ulica',
'title' => 'Tytuł',
'description' => 'Opis',

View File

@ -1418,10 +1418,12 @@ return [
'flate-rate-shipping' => 'Envio de taxa fixa',
'shipping' => 'Remessa',
'origin' => 'Origem',
'requirements' => 'Requirements',
'country' => 'País',
'state' => 'Estado',
'zip' => 'CEP',
'city' => 'Cidade',
'information' => 'Information',
'street-address' => 'Endereço',
'title' => 'Titulo',
'description' => 'Descrição',

View File

@ -1406,10 +1406,12 @@ return [
'flate-rate-shipping' => 'Sabit Fiyat Teslimat',
'shipping' => 'Teslimat',
'origin' => 'Menşei',
'requirements' => 'Requirements',
'country' => 'Ülke',
'state' => 'Şehir',
'zip' => 'Posta Kodu',
'city' => 'İlçe',
'information' => 'Information',
'street-address' => 'Sokak Adresi',
'title' => 'Başlık',
'description' => 'Açıklama',

View File

@ -3,6 +3,8 @@
namespace Webkul\Checkout\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Webkul\Core\Contracts\Validations\AlphaNumericSpace;
use Webkul\Core\Contracts\Validations\PhoneNumber;
class CustomerAddressForm extends FormRequest
{
@ -30,65 +32,69 @@ class CustomerAddressForm extends FormRequest
*/
public function rules(): array
{
$customerAddressIds = $this->getCustomerAddressIds();
if (isset($this->get('billing')['address_id'])) {
$billingAddressRules = [
'billing.address_id' => ['required'],
];
if (! empty($customerAddressIds)) {
$billingAddressRules['billing.address_id'][] = "in:{$customerAddressIds}";
}
$this->mergeWithRules($billingAddressRules);
$this->mergeExistingAddressRules('billing');
} else {
$this->mergeWithRules([
'billing.first_name' => ['required'],
'billing.last_name' => ['required'],
'billing.email' => ['required'],
'billing.address1' => ['required'],
'billing.city' => ['required'],
'billing.state' => ['required'],
'billing.postcode' => ['required'],
'billing.phone' => ['required'],
'billing.country' => ['required'],
]);
$this->mergeNewAddressRules('billing');
}
if (isset($this->get('billing')['use_for_shipping']) && ! $this->get('billing')['use_for_shipping']) {
if (isset($this->get('shipping')['address_id'])) {
$shippingAddressRules = [
'shipping.address_id' => ['required'],
];
if (! empty($customerAddressIds)) {
$shippingAddressRules['shipping.address_id'][] = "in:{$customerAddressIds}";
}
$this->mergeWithRules($shippingAddressRules);
$this->mergeExistingAddressRules('shipping');
} else {
$this->mergeWithRules([
'shipping.first_name' => ['required'],
'shipping.last_name' => ['required'],
'shipping.email' => ['required'],
'shipping.address1' => ['required'],
'shipping.city' => ['required'],
'shipping.state' => ['required'],
'shipping.postcode' => ['required'],
'shipping.phone' => ['required'],
'shipping.country' => ['required'],
]);
$this->mergeNewAddressRules('shipping');
}
}
return $this->rules;
}
/**
* Merge existing address rules.
*
* @param string $addressType
* @return void
*/
private function mergeExistingAddressRules(string $addressType)
{
$customerAddressIds = $this->getCustomerAddressIds();
$addressRules = [
"{$addressType}.address_id" => ['required'],
];
if (! empty($customerAddressIds)) {
$addressRules["{$addressType}.address_id"][] = "in:{$customerAddressIds}";
}
$this->mergeWithRules($addressRules);
}
/**
* Merge new address rules.
*
* @param string $addressType
* @return void
*/
private function mergeNewAddressRules(string $addressType)
{
$this->mergeWithRules([
"{$addressType}.first_name" => ['required', new AlphaNumericSpace],
"{$addressType}.last_name" => ['required', new AlphaNumericSpace],
"{$addressType}.email" => ['required'],
"{$addressType}.address1" => ['required'],
"{$addressType}.city" => ['required'],
"{$addressType}.country" => [new AlphaNumericSpace],
"{$addressType}.state" => [new AlphaNumericSpace],
"{$addressType}.postcode" => ['numeric'],
"{$addressType}.phone" => ['required', new PhoneNumber],
]);
}
/**
* Merge additional rules.
*
* @return string
* @return void
*/
private function mergeWithRules($additionalRules): void
{

View File

@ -860,13 +860,7 @@ class Core
}
if (! $coreConfigValue) {
$fields = explode('.', $field);
array_shift($fields);
$field = implode('.', $fields);
return Config::get($field);
return $this->getDefaultConfig($field);
}
return $coreConfigValue->value;
@ -951,6 +945,36 @@ class Core
}
}
/**
* Is country required.
*
* @return bool
*/
public function isCountryRequired()
{
return $this->getConfigData('customer.address.requirements.country') == 1;
}
/**
* Is state required.
*
* @return bool
*/
public function isStateRequired()
{
return $this->getConfigData('customer.address.requirements.state') == 1;
}
/**
* Is postcode required.
*
* @return bool
*/
public function isPostCodeRequired()
{
return $this->getConfigData('customer.address.requirements.postcode') == 1;
}
/**
* Returns time intervals.
*
@ -1292,4 +1316,23 @@ class Core
return $coreConfigValue;
}
/**
* Get default config.
*
* @param string $field
* @return mixed
*/
protected function getDefaultConfig($field)
{
$configFieldInfo = $this->getConfigField($field);
$fields = explode('.', $field);
array_shift($fields);
$field = implode('.', $fields);
return Config::get($field, $configFieldInfo['default'] ?? null);
}
}

View File

@ -5,11 +5,12 @@ namespace Webkul\Core\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Webkul\Customer\Models\Customer;
use Webkul\Core\Contracts\Address as AddressContract;
use Webkul\Customer\Models\Customer;
/**
* Class Address
* Address class.
*
* @package Webkul\Core\Models
*
* @property string $address_type
@ -34,18 +35,32 @@ use Webkul\Core\Contracts\Address as AddressContract;
* @property-read string $name
* @property-read Carbon $created_at
* @property-read Carbon $updated_at
*
*/
abstract class Address extends Model implements AddressContract
{
/**
* Table.
*
* @var string
*/
protected $table = 'addresses';
/**
* Guarded.
*
* @var array
*/
protected $guarded = [
'id',
'created_at',
'updated_at',
];
/**
* Fillable.
*
* @var array
*/
protected $fillable = [
'address_type',
'customer_id',
@ -68,6 +83,11 @@ abstract class Address extends Model implements AddressContract
'additional',
];
/**
* Castable.
*
* @var array
*/
protected $casts = [
'additional' => 'array',
'default_address' => 'boolean',
@ -75,6 +95,8 @@ abstract class Address extends Model implements AddressContract
/**
* Get all the attributes for the attribute groups.
*
* @return string
*/
public function getNameAttribute(): string
{
@ -83,6 +105,8 @@ abstract class Address extends Model implements AddressContract
/**
* Get the customer record associated with the address.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function customer(): BelongsTo
{

View File

@ -4,28 +4,28 @@ return [
[
'key' => 'customer.captcha',
'name' => 'customer::app.admin.system.captcha.title',
'sort' => 1,
'sort' => 2,
], [
'key' => 'customer.captcha.credentials',
'name' => 'customer::app.admin.system.captcha.credentials',
'sort' => 1,
'fields' => [
[
'name' => 'site_key',
'title' => 'customer::app.admin.system.captcha.site-key',
'type' => 'text',
'name' => 'site_key',
'title' => 'customer::app.admin.system.captcha.site-key',
'type' => 'text',
'channel_based' => true,
], [
'name' => 'secret_key',
'title' => 'customer::app.admin.system.captcha.secret-key',
'type' => 'text',
'name' => 'secret_key',
'title' => 'customer::app.admin.system.captcha.secret-key',
'type' => 'text',
'channel_based' => true,
], [
'name' => 'status',
'title' => 'customer::app.admin.system.captcha.status',
'type' => 'boolean',
'channel_based' => true,
]
],
],
],
];

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateCountryStateAndZipCodeInAddressesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('addresses', function (Blueprint $table) {
$table->string('country')->nullable()->change();
$table->string('state')->nullable()->change();
$table->string('postcode')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('addresses', function (Blueprint $table) {
$table->string('country')->nullable(false)->change();
$table->string('state')->nullable(false)->change();
$table->string('postcode')->nullable(false)->change();
});
}
}

View File

@ -33,10 +33,10 @@ class CustomerAddressRequest extends FormRequest
'last_name' => ['required', new AlphaNumericSpace],
'address1' => ['required', 'array'],
'address1.*' => ['required', new Address],
'country' => ['required', 'alpha'],
'state' => ['required', new AlphaNumericSpace],
'country' => [new AlphaNumericSpace],
'state' => [new AlphaNumericSpace],
'city' => ['required'],
'postcode' => ['required', 'numeric'],
'postcode' => ['numeric'],
'phone' => ['required', new PhoneNumber],
'vat_id' => [new VatIdRule()],
];

View File

@ -1,14 +1,17 @@
<?php
/**
* For parent sales key, check the sales package config file,
* i.e. `packages/Webkul/Sales/src/Config/system.php`
*/
return [
/**
* Payment methods.
*/
[
'key' => 'sales',
'name' => 'admin::app.admin.system.sales',
'sort' => 1
], [
'key' => 'sales.paymentmethods',
'name' => 'admin::app.admin.system.payment-methods',
'sort' => 2,
'sort' => 3,
], [
'key' => 'sales.paymentmethods.cashondelivery',
'name' => 'admin::app.admin.system.cash-on-delivery',
@ -42,37 +45,37 @@ return [
'channel_based' => true,
'locale_based' => false,
], [
'name' => 'invoice_status',
'title' => 'admin::app.admin.system.set-invoice-status',
'name' => 'invoice_status',
'title' => 'admin::app.admin.system.set-invoice-status',
'validation' => 'required_if:generate_invoice,1',
'type' => 'select',
'options' => [
'type' => 'select',
'options' => [
[
'title' => 'admin::app.sales.invoices.status-pending',
'value' => 'pending'
'value' => 'pending',
], [
'title' => 'admin::app.sales.invoices.status-paid',
'value' => 'paid'
]
'value' => 'paid',
],
],
'info' => 'admin::app.admin.system.generate-invoice-applicable',
'channel_based' => true,
'locale_based' => false,
], [
'name' => 'order_status',
'title' => 'admin::app.admin.system.set-order-status',
'type' => 'select',
'options' => [
'name' => 'order_status',
'title' => 'admin::app.admin.system.set-order-status',
'type' => 'select',
'options' => [
[
'title' => 'admin::app.sales.orders.order-status-pending',
'value' => 'pending'
'value' => 'pending',
], [
'title' => 'admin::app.sales.orders.order-status-pending-payment',
'value' => 'pending_payment'
'value' => 'pending_payment',
], [
'title' => 'admin::app.sales.orders.order-status-processing',
'value' => 'processing'
]
'value' => 'processing',
],
],
'info' => 'admin::app.admin.system.generate-invoice-applicable',
'channel_based' => true,
@ -91,20 +94,20 @@ return [
'options' => [
[
'title' => '1',
'value' => 1
'value' => 1,
], [
'title' => '2',
'value' => 2
'value' => 2,
], [
'title' => '3',
'value' => 3
'value' => 3,
], [
'title' => '4',
'value' => 4,
]
],
],
]
]
],
],
], [
'key' => 'sales.paymentmethods.moneytransfer',
'name' => 'admin::app.admin.system.money-transfer',
@ -138,13 +141,13 @@ return [
'options' => [
[
'title' => 'admin::app.sales.invoices.status-pending',
'value' => 'pending'
'value' => 'pending',
], [
'title' => 'admin::app.sales.invoices.status-paid',
'value' => 'paid'
]
'value' => 'paid',
],
],
'info' => 'admin::app.admin.system.generate-invoice-applicable',
'info' => 'admin::app.admin.system.generate-invoice-applicable',
], [
'name' => 'order_status',
'title' => 'Order status after creating the invoice',
@ -152,16 +155,16 @@ return [
'options' => [
[
'title' => 'admin::app.sales.orders.order-status-pending',
'value' => 'pending'
'value' => 'pending',
], [
'title' => 'admin::app.sales.orders.order-status-pending-payment',
'value' => 'pending_payment'
'value' => 'pending_payment',
], [
'title' => 'admin::app.sales.orders.order-status-processing',
'value' => 'processing'
]
'value' => 'processing',
],
],
'info' => 'admin::app.admin.system.generate-invoice-applicable',
'info' => 'admin::app.admin.system.generate-invoice-applicable',
], [
'name' => 'mailing_address',
'title' => 'admin::app.admin.system.mailing-address',
@ -175,7 +178,7 @@ return [
'validation' => 'required',
'channel_based' => true,
'locale_based' => true,
],[
], [
'name' => 'sort',
'title' => 'admin::app.admin.system.sort_order',
'type' => 'select',
@ -192,9 +195,9 @@ return [
], [
'title' => '4',
'value' => 4,
]
],
],
]
]
]
];
],
],
],
];

View File

@ -2,12 +2,29 @@
return [
/**
* Order Settings
* Sales.
*
* Child keys are in different package.
*
* Sort `1` | Shipping | Shipping Package
* Sort `2` | Shipping Method | Shipping Package
* Sort `3` | Payment Method | Payment Package
* Sort `4` | Order Settings | Self
* Sort `5` | Invoice Settings | Self
*/
[
'key' => 'sales',
'name' => 'admin::app.admin.system.sales',
'sort' => 5,
],
/**
* Order settings.
*/
[
'key' => 'sales.orderSettings',
'name' => 'admin::app.admin.system.order-settings',
'sort' => 3,
'sort' => 4,
], [
'key' => 'sales.orderSettings.order_number',
'name' => 'admin::app.admin.system.orderNumber',
@ -45,7 +62,7 @@ return [
'channel_based' => true,
'locale_based' => true,
],
]
],
], [
'key' => 'sales.orderSettings.minimum-order',
'name' => 'admin::app.admin.system.minimum-order',
@ -59,16 +76,16 @@ return [
'channel_based' => true,
'locale_based' => true,
],
]
],
],
/**
* Invoice Settings
* Invoice settings.
*/
[
'key' => 'sales.invoice_setttings',
'name' => 'admin::app.admin.system.invoice-settings',
'sort' => 4,
'sort' => 5,
], [
'key' => 'sales.invoice_setttings.invoice_number',
'name' => 'admin::app.admin.system.invoice-number',
@ -106,7 +123,7 @@ return [
'channel_based' => true,
'locale_based' => true,
],
]
],
], [
'key' => 'sales.invoice_setttings.payment_terms',
'name' => 'admin::app.admin.system.payment-terms',
@ -119,7 +136,7 @@ return [
'validation' => 'numeric',
'channel_based' => true,
],
]
],
], [
'key' => 'sales.invoice_setttings.invoice_slip_design',
'name' => 'admin::app.admin.system.invoice-slip-design',
@ -132,7 +149,7 @@ return [
'validation' => 'mimes:bmp,jpeg,jpg,png,webp',
'channel_based' => true,
],
]
],
], [
'key' => 'sales.invoice_setttings.invoice_reminders',
'name' => 'admin::app.admin.system.invoice-reminders',
@ -146,10 +163,10 @@ return [
'channel_based' => true,
],
[
'name' => 'interval_between_reminders',
'title' => 'admin::app.admin.system.interval-between-reminders',
'type' => 'select',
'options' => [
'name' => 'interval_between_reminders',
'title' => 'admin::app.admin.system.interval-between-reminders',
'type' => 'select',
'options' => [
[
'title' => '1 day',
'value' => 'P1D',
@ -183,6 +200,6 @@ return [
],
],
],
]
],
],
];

View File

@ -1,109 +1,17 @@
<?php
/**
* For parent sales key, check the sales package config file,
* i.e. `packages/Webkul/Sales/src/Config/system.php`
*/
return [
/**
* Shipping.
*/
[
'key' => 'sales',
'name' => 'admin::app.admin.system.sales',
'sort' => 5,
], [
'key' => 'sales.carriers',
'name' => 'admin::app.admin.system.shipping-methods',
'sort' => 1,
], [
'key' => 'sales.carriers.free',
'name' => 'admin::app.admin.system.free-shipping',
'sort' => 1,
'fields' => [
[
'name' => 'title',
'title' => 'admin::app.admin.system.title',
'type' => 'depends',
'depend' => 'active:1',
'validation' => 'required_if:active,1',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'description',
'title' => 'admin::app.admin.system.description',
'type' => 'textarea',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'active',
'title' => 'admin::app.admin.system.status',
'type' => 'boolean',
'validation' => 'required',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'is_calculate_tax',
'title' => 'admin::app.admin.system.calculate-tax',
'type' => 'boolean',
'validation' => 'required',
'channel_based' => false,
'locale_based' => false,
]
]
], [
'key' => 'sales.carriers.flatrate',
'name' => 'admin::app.admin.system.flate-rate-shipping',
'sort' => 2,
'fields' => [
[
'name' => 'title',
'title' => 'admin::app.admin.system.title',
'type' => 'depends',
'depend' => 'active:1',
'validation' => 'required_if:active,1',
'channel_based' => true,
'locale_based' => true,
], [
'name' => 'description',
'title' => 'admin::app.admin.system.description',
'type' => 'textarea',
'channel_based' => true,
'locale_based' => false,
], [
'name' => 'default_rate',
'title' => 'admin::app.admin.system.rate',
'type' => 'depends',
'depend' => 'active:1',
'validation' => 'required_if:active,1',
'channel_based' => true,
'locale_based' => false,
], [
'name' => 'type',
'title' => 'admin::app.admin.system.type',
'type' => 'select',
'options' => [
[
'title' => 'Per Unit',
'value' => 'per_unit',
], [
'title' => 'Per Order',
'value' => 'per_order',
]
],
], [
'name' => 'active',
'title' => 'admin::app.admin.system.status',
'type' => 'boolean',
'validation' => 'required',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'is_calculate_tax',
'title' => 'admin::app.admin.system.calculate-tax',
'type' => 'boolean',
'validation' => 'required',
'channel_based' => false,
'locale_based' => false,
]
]
], [
'key' => 'sales.shipping',
'name' => 'admin::app.admin.system.shipping',
'sort' => 0,
'sort' => 1,
], [
'key' => 'sales.shipping.origin',
'name' => 'admin::app.admin.system.origin',
@ -123,7 +31,7 @@ return [
'validation' => 'required',
'channel_based' => true,
'locale_based' => true,
], [
], [
'name' => 'city',
'title' => 'admin::app.admin.system.city',
'type' => 'text',
@ -164,7 +72,107 @@ return [
'title' => 'admin::app.admin.system.bank-details',
'type' => 'textarea',
'channel_based' => true,
]
]
]
],
],
],
/**
* Shipping method.
*/
[
'key' => 'sales.carriers',
'name' => 'admin::app.admin.system.shipping-methods',
'sort' => 2,
], [
'key' => 'sales.carriers.free',
'name' => 'admin::app.admin.system.free-shipping',
'sort' => 1,
'fields' => [
[
'name' => 'title',
'title' => 'admin::app.admin.system.title',
'type' => 'depends',
'depend' => 'active:1',
'validation' => 'required_if:active,1',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'description',
'title' => 'admin::app.admin.system.description',
'type' => 'textarea',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'active',
'title' => 'admin::app.admin.system.status',
'type' => 'boolean',
'validation' => 'required',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'is_calculate_tax',
'title' => 'admin::app.admin.system.calculate-tax',
'type' => 'boolean',
'validation' => 'required',
'channel_based' => false,
'locale_based' => false,
],
],
], [
'key' => 'sales.carriers.flatrate',
'name' => 'admin::app.admin.system.flate-rate-shipping',
'sort' => 2,
'fields' => [
[
'name' => 'title',
'title' => 'admin::app.admin.system.title',
'type' => 'depends',
'depend' => 'active:1',
'validation' => 'required_if:active,1',
'channel_based' => true,
'locale_based' => true,
], [
'name' => 'description',
'title' => 'admin::app.admin.system.description',
'type' => 'textarea',
'channel_based' => true,
'locale_based' => false,
], [
'name' => 'default_rate',
'title' => 'admin::app.admin.system.rate',
'type' => 'depends',
'depend' => 'active:1',
'validation' => 'required_if:active,1',
'channel_based' => true,
'locale_based' => false,
], [
'name' => 'type',
'title' => 'admin::app.admin.system.type',
'type' => 'select',
'options' => [
[
'title' => 'Per Unit',
'value' => 'per_unit',
], [
'title' => 'Per Order',
'value' => 'per_order',
],
],
], [
'name' => 'active',
'title' => 'admin::app.admin.system.status',
'type' => 'boolean',
'validation' => 'required',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'is_calculate_tax',
'title' => 'admin::app.admin.system.calculate-tax',
'type' => 'boolean',
'validation' => 'required',
'channel_based' => false,
'locale_based' => false,
],
],
],
];

View File

@ -3,25 +3,25 @@
namespace Webkul\Shop\Http\Controllers;
use Illuminate\Support\Facades\Event;
use Webkul\Shop\Http\Controllers\Controller;
use Webkul\Checkout\Facades\Cart;
use Webkul\Shipping\Facades\Shipping;
use Webkul\Payment\Facades\Payment;
use Webkul\Checkout\Http\Requests\CustomerAddressForm;
use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Customer\Repositories\CustomerRepository;
use Webkul\Payment\Facades\Payment;
use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Shipping\Facades\Shipping;
use Webkul\Shop\Http\Controllers\Controller;
class OnepageController extends Controller
{
/**
* OrderRepository object
* Order repository instance.
*
* @var \Webkul\Sales\Repositories\OrderRepository
*/
protected $orderRepository;
/**
* customerRepository instance object
/**
* Customer repository instance.
*
* @var \Webkul\Customer\Repositories\CustomerRepository
*/
@ -37,8 +37,7 @@ class OnepageController extends Controller
public function __construct(
OrderRepository $orderRepository,
CustomerRepository $customerRepository
)
{
) {
$this->orderRepository = $orderRepository;
$this->customerRepository = $customerRepository;
@ -50,7 +49,7 @@ class OnepageController extends Controller
* Display a listing of the resource.
*
* @return \Illuminate\View\View
*/
*/
public function index()
{
Event::dispatch('checkout.load.index');
@ -88,10 +87,10 @@ class OnepageController extends Controller
}
/**
* Return order short summary
* Return order short summary.
*
* @return \Illuminate\Http\Response
*/
*/
public function summary()
{
$cart = Cart::getCart();
@ -106,10 +105,10 @@ class OnepageController extends Controller
*
* @param \Webkul\Checkout\Http\Requests\CustomerAddressForm $request
* @return \Illuminate\Http\Response
*/
*/
public function saveAddress(CustomerAddressForm $request)
{
$data = request()->all();
$data = $request->all();
if (! auth()->guard('customer')->check() && ! Cart::getCart()->hasGuestCheckoutItems()) {
return response()->json(['redirect_url' => route('customer.session.index')], 403);
@ -120,33 +119,33 @@ class OnepageController extends Controller
if (Cart::hasError() || ! Cart::saveCustomerAddress($data)) {
return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403);
} else {
$cart = Cart::getCart();
Cart::collectTotals();
if ($cart->haveStockableItems()) {
if (! $rates = Shipping::collectRates()) {
return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403);
} else {
return response()->json($rates);
}
} else {
return response()->json(Payment::getSupportedPaymentMethods());
}
}
$cart = Cart::getCart();
Cart::collectTotals();
if ($cart->haveStockableItems()) {
if (! $rates = Shipping::collectRates()) {
return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403);
}
return response()->json($rates);
}
return response()->json(Payment::getSupportedPaymentMethods());
}
/**
* Saves shipping method.
*
* @return \Illuminate\Http\Response
*/
*/
public function saveShipping()
{
$shippingMethod = request()->get('shipping_method');
if (Cart::hasError() || !$shippingMethod || !Cart::saveShippingMethod($shippingMethod)) {
if (Cart::hasError() || ! $shippingMethod || ! Cart::saveShippingMethod($shippingMethod)) {
return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403);
}
@ -159,7 +158,7 @@ class OnepageController extends Controller
* Saves payment method.
*
* @return \Illuminate\Http\Response
*/
*/
public function savePayment()
{
$payment = request()->get('payment');
@ -182,7 +181,7 @@ class OnepageController extends Controller
* Saves order.
*
* @return \Illuminate\Http\Response
*/
*/
public function saveOrder()
{
if (Cart::hasError()) {
@ -216,10 +215,10 @@ class OnepageController extends Controller
}
/**
* Order success page
* Order success page.
*
* @return \Illuminate\Http\Response
*/
*/
public function success()
{
if (! $order = session('order')) {
@ -230,7 +229,7 @@ class OnepageController extends Controller
}
/**
* Validate order before creation
* Validate order before creation.
*
* @return void|\Exception
*/
@ -262,32 +261,32 @@ class OnepageController extends Controller
}
/**
* Check Customer is exist or not
* Check customer is exist or not.
*
* @return \Illuminate\Http\Response
*/
public function checkExistCustomer()
{
$customer = $this->customerRepository->findOneWhere([
$customer = $this->customerRepository->findOneWhere([
'email' => request()->email,
]);
]);
if (! is_null($customer)) {
return 'true';
}
if (! is_null($customer)) {
return 'true';
}
return 'false';
return 'false';
}
/**
* Login for checkout
* Login for checkout.
*
* @return \Illuminate\Http\Response
*/
public function loginForCheckout()
{
$this->validate(request(), [
'email' => 'required|email'
'email' => 'required|email',
]);
if (! auth()->guard('customer')->attempt(request(['email', 'password']))) {
@ -300,7 +299,7 @@ class OnepageController extends Controller
}
/**
* To apply couponable rule requested
* To apply couponable rule requested.
*
* @return \Illuminate\Http\Response
*/
@ -322,19 +321,17 @@ class OnepageController extends Controller
'message' => trans('shop::app.checkout.total.coupon-applied'),
'result' => $result,
], 200);
} else {
return response()->json([
'success' => false,
'message' => trans('shop::app.checkout.total.cannot-apply-coupon'),
'result' => null,
], 422);
}
return $result;
return response()->json([
'success' => false,
'message' => trans('shop::app.checkout.total.cannot-apply-coupon'),
'result' => null,
], 422);
}
/**
* Initiates the removal of couponable cart rule
* Initiates the removal of couponable cart rule.
*
* @return array
*/
@ -352,13 +349,13 @@ class OnepageController extends Controller
'grand_total' => core()->currency(Cart::getCart()->grand_total),
],
], 200);
} else {
return response()->json([
'success' => false,
'message' => trans('admin::app.promotion.status.coupon-remove-failed'),
'data' => null,
], 422);
}
return response()->json([
'success' => false,
'message' => trans('admin::app.promotion.status.coupon-remove-failed'),
'data' => null,
], 422);
}
/**
@ -373,8 +370,8 @@ class OnepageController extends Controller
$status = Cart::checkMinimumOrder();
return response()->json([
'status' => ! $status ? false : true,
'status' => ! $status ? false : true,
'message' => ! $status ? trans('shop::app.checkout.cart.minimum-order-message', ['amount' => core()->currency($minimumOrderAmount)]) : 'Success',
]);
}
}
}

View File

@ -17,6 +17,7 @@
<ul class="checkout-steps">
<li class="active" :class="[completed_step >= 0 ? 'active' : '', completed_step > 0 ? 'completed' : '']" @click="navigateToStep(1)">
<div class="decorator address-info"></div>
<span>{{ __('shop::app.checkout.onepage.information') }}</span>
</li>
@ -25,6 +26,7 @@
@if ($cart->haveStockableItems())
<li :class="[current_step == 2 || completed_step > 1 ? 'active' : '', completed_step > 1 ? 'completed' : '']" @click="navigateToStep(2)">
<div class="decorator shipping"></div>
<span>{{ __('shop::app.checkout.onepage.shipping') }}</span>
</li>
@ -33,6 +35,7 @@
<li :class="[current_step == 3 || completed_step > 2 ? 'active' : '', completed_step > 2 ? 'completed' : '']" @click="navigateToStep(3)">
<div class="decorator payment"></div>
<span>{{ __('shop::app.checkout.onepage.payment') }}</span>
</li>
@ -61,7 +64,6 @@
<button type="button" class="btn btn-lg btn-primary" @click="validateForm('shipping-form')" :disabled="disable_button" id="checkout-shipping-continue-button">
{{ __('shop::app.checkout.onepage.continue') }}
</button>
</div>
</div>
@ -104,13 +106,13 @@
</script>
<script>
var shippingHtml = '';
var paymentHtml = '';
var reviewHtml = '';
var summaryHtml = '';
var customerAddress = '';
var shippingMethods = '';
var paymentMethods = '';
let shippingHtml = '';
let paymentHtml = '';
let reviewHtml = '';
let summaryHtml = '';
let customerAddress = '';
let shippingMethods = '';
let paymentMethods = '';
@auth('customer')
@if(auth('customer')->user()->addresses)
@ -190,16 +192,6 @@
this.new_billing_address = true;
} else {
this.allAddress = customerAddress;
for (var country in this.country) {
for (var code in this.allAddress) {
if (this.allAddress[code].country) {
if (this.allAddress[code].country == this.country[country].code) {
this.allAddress[code]['country'] = this.country[country].name;
}
}
}
}
}
}
},
@ -220,16 +212,16 @@
},
validateForm: async function(scope) {
var this_this = this;
let self = this;
await this.$validator.validateAll(scope).then(function (result) {
if (result) {
if (scope == 'address-form') {
this_this.saveAddress();
self.saveAddress();
} else if (scope == 'shipping-form') {
this_this.saveShipping();
self.saveShipping();
} else if (scope == 'payment-form') {
this_this.savePayment();
self.savePayment();
}
}
});
@ -238,16 +230,16 @@
isCustomerExist: function() {
this.$validator.attach({ name: "email", rules: "required|email" });
var this_this = this;
let self = this;
this.$validator.validate('email', this.address.billing.email)
.then(function(isValid) {
if (! isValid)
return;
this_this.$http.post("{{ route('customer.checkout.exist') }}", {email: this_this.address.billing.email})
self.$http.post("{{ route('customer.checkout.exist') }}", {email: self.address.billing.email})
.then(function(response) {
this_this.is_customer_exist = response.data ? 1 : 0;
self.is_customer_exist = response.data ? 1 : 0;
})
.catch(function (error) {})
@ -255,11 +247,11 @@
},
loginCustomer: function() {
var this_this = this;
let self = this;
this_this.$http.post("{{ route('customer.checkout.login') }}", {
email: this_this.address.billing.email,
password: this_this.address.billing.password
self.$http.post("{{ route('customer.checkout.login') }}", {
email: self.address.billing.email,
password: self.address.billing.password
})
.then(function(response) {
if (response.data.success) {
@ -267,27 +259,26 @@
} else {
window.flashMessages = [{'type': 'alert-error', 'message': response.data.error }];
this_this.$root.addFlashMessages()
self.$root.addFlashMessages()
}
})
.catch(function (error) {})
},
getOrderSummary () {
var this_this = this;
let self = this;
this.$http.get("{{ route('shop.checkout.summary') }}")
.then(function(response) {
summaryHtml = Vue.compile(response.data.html)
this_this.summeryComponentKey++;
//this_this.reviewComponentKey++;
self.summeryComponentKey++;
})
.catch(function (error) {})
},
saveAddress: async function() {
var this_this = this;
let self = this;
this.disable_button = true;
@ -305,76 +296,76 @@
this.$http.post("{{ route('shop.checkout.save-address') }}", this.address)
.then(function(response) {
this_this.disable_button = false;
self.disable_button = false;
if (this_this.step_numbers[response.data.jump_to_section] == 2)
if (self.step_numbers[response.data.jump_to_section] == 2)
shippingHtml = Vue.compile(response.data.html)
else
paymentHtml = Vue.compile(response.data.html)
this_this.completed_step = this_this.step_numbers[response.data.jump_to_section] - 1;
this_this.current_step = this_this.step_numbers[response.data.jump_to_section];
self.completed_step = self.step_numbers[response.data.jump_to_section] - 1;
self.current_step = self.step_numbers[response.data.jump_to_section];
shippingMethods = response.data.shippingMethods;
paymentMethods = response.data.paymentMethods;
this_this.getOrderSummary();
self.getOrderSummary();
})
.catch(function (error) {
this_this.disable_button = false;
self.disable_button = false;
this_this.handleErrorResponse(error.response, 'address-form')
self.handleErrorResponse(error.response, 'address-form')
})
},
saveShipping: async function() {
var this_this = this;
let self = this;
this.disable_button = true;
this.$http.post("{{ route('shop.checkout.save-shipping') }}", {'shipping_method': this.selected_shipping_method})
.then(function(response) {
this_this.disable_button = false;
self.disable_button = false;
paymentHtml = Vue.compile(response.data.html)
this_this.completed_step = this_this.step_numbers[response.data.jump_to_section] - 1;
this_this.current_step = this_this.step_numbers[response.data.jump_to_section];
self.completed_step = self.step_numbers[response.data.jump_to_section] - 1;
self.current_step = self.step_numbers[response.data.jump_to_section];
paymentMethods = response.data.paymentMethods;
this_this.getOrderSummary();
self.getOrderSummary();
})
.catch(function (error) {
this_this.disable_button = false;
self.disable_button = false;
this_this.handleErrorResponse(error.response, 'shipping-form')
self.handleErrorResponse(error.response, 'shipping-form')
})
},
savePayment: async function() {
var this_this = this;
let self = this;
this.disable_button = true;
this.$http.post("{{ route('shop.checkout.save-payment') }}", {'payment': this.selected_payment_method})
.then(function(response) {
this_this.disable_button = false;
self.disable_button = false;
reviewHtml = Vue.compile(response.data.html)
this_this.completed_step = this_this.step_numbers[response.data.jump_to_section] - 1;
this_this.current_step = this_this.step_numbers[response.data.jump_to_section];
self.completed_step = self.step_numbers[response.data.jump_to_section] - 1;
self.current_step = self.step_numbers[response.data.jump_to_section];
this_this.getOrderSummary();
self.getOrderSummary();
})
.catch(function (error) {
this_this.disable_button = false;
self.disable_button = false;
this_this.handleErrorResponse(error.response, 'payment-form')
self.handleErrorResponse(error.response, 'payment-form')
});
},
placeOrder: async function() {
var this_this = this;
let self = this;
this.disable_button = true;
@ -389,11 +380,11 @@
}
})
.catch(function (error) {
this_this.disable_button = true;
self.disable_button = true;
window.flashMessages = [{'type': 'alert-error', 'message': "{{ __('shop::app.common.error') }}" }];
this_this.$root.addFlashMessages()
self.$root.addFlashMessages()
})
},
@ -434,9 +425,9 @@
this.new_shipping_address = false;
},
}
})
});
var shippingTemplateRenderFns = [];
let shippingTemplateRenderFns = [];
Vue.component('shipping-section', {
inject: ['$validator'],
@ -465,7 +456,7 @@
}
this.templateRender = shippingHtml.render;
for (var i in shippingHtml.staticRenderFns) {
for (let i in shippingHtml.staticRenderFns) {
shippingTemplateRenderFns.push(shippingHtml.staticRenderFns[i]);
}
@ -487,9 +478,9 @@
eventBus.$emit('after-shipping-method-selected', this.selected_shipping_method);
}
}
})
});
var paymentTemplateRenderFns = [];
let paymentTemplateRenderFns = [];
Vue.component('payment-section', {
inject: ['$validator'],
@ -518,7 +509,7 @@
}
this.templateRender = paymentHtml.render;
for (var i in paymentHtml.staticRenderFns) {
for (let i in paymentHtml.staticRenderFns) {
paymentTemplateRenderFns.push(paymentHtml.staticRenderFns[i]);
}
@ -542,9 +533,9 @@
eventBus.$emit('after-payment-method-selected', this.payment);
}
}
})
});
var reviewTemplateRenderFns = [];
let reviewTemplateRenderFns = [];
Vue.component('review-section', {
data: function() {
@ -568,8 +559,7 @@
mounted: function() {
this.templateRender = reviewHtml.render;
for (var i in reviewHtml.staticRenderFns) {
// reviewTemplateRenderFns.push(reviewHtml.staticRenderFns[i]);
for (let i in reviewHtml.staticRenderFns) {
reviewTemplateRenderFns[i] = reviewHtml.staticRenderFns[i];
}
@ -577,8 +567,7 @@
}
});
var summaryTemplateRenderFns = [];
let summaryTemplateRenderFns = [];
Vue.component('summary-section', {
inject: ['$validator'],
@ -594,8 +583,7 @@
mounted: function() {
this.templateRender = summaryHtml.render;
for (var i in summaryHtml.staticRenderFns) {
// summaryTemplateRenderFns.push(summaryHtml.staticRenderFns[i]);
for (let i in summaryHtml.staticRenderFns) {
summaryTemplateRenderFns[i] = summaryHtml.staticRenderFns[i];
}
@ -609,7 +597,6 @@
'')
]);
}
})
});
</script>
@endpush

View File

@ -6,7 +6,7 @@
</div>
<div class="control-group" id="login-and-forgot-btn">
<div class="forgot-password-link" style="float: right;margin-right: 503px; margin-top: 11px;">
<div class="forgot-password-link" style="float: right; margin-right: 503px; margin-top: 11px;">
<a href="{{ route('customer.forgot-password.create') }}">{{ __('shop::app.customer.login-form.forgot_pass') }}</a>
<div class="mt-10">

View File

@ -1,56 +1,59 @@
<form data-vv-scope="address-form">
<div class="form-container" v-if="!this.new_billing_address">
<div class="form-container" v-if="! this.new_billing_address">
<div class="form-header mb-30">
<span class="checkout-step-heading">{{ __('shop::app.checkout.onepage.billing-address') }}</span>
<a class="btn btn-lg btn-primary" @click = newBillingAddress()>
<a class="btn btn-lg btn-primary" @click="newBillingAddress()">
{{ __('shop::app.checkout.onepage.new-address') }}
</a>
</div>
<div class="address-holder">
<div class="address-card" v-for='(addresses, index) in this.allAddress'>
<div class="checkout-address-content" style="display: flex; flex-direction: row; justify-content: space-between; width: 100%;">
<label class="radio-container" style="float: right; width: 10%;">
<input type="radio" v-validate="'required'" id="billing[address_id]" name="billing[address_id]" :value="addresses.id" v-model="address.billing.address_id" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.billing-address') }}&quot;">
<span class="checkmark"></span>
</label>
<ul class="address-card-list" style="float: right; width: 85%;">
<li class="mb-5" v-if="addresses.company_name != ''">
@{{ addresses.company_name }}
</li>
<li class="mb-10">
<b>@{{ allAddress.first_name }} @{{ allAddress.last_name }},</b>
<b v-text="`${allAddress.first_name} ${allAddress.last_name}`"></b>
</li>
<li class="mb-5">
@{{ addresses.address1 }},
<li
class="mb-5"
v-text="addresses.company_name"
v-if="addresses.company_name != ''">
</li>
<li class="mb-5">
@{{ addresses.city }},
</li>
<li class="mb-5" v-text="addresses.address1"></li>
<li class="mb-5">
@{{ addresses.state }},
</li>
<li class="mb-5" v-text="addresses.city"></li>
<li class="mb-5" v-text="addresses.state"></li>
<li class="mb-15">
@{{ addresses.country }} @{{ addresses.postcode }}
<span v-text="addresses.country" v-if="addresses.country"></span>
<span v-text="addresses.postcode" v-if="addresses.postcode"></span>
</li>
<li>
<b>{{ __('shop::app.customer.account.address.index.contact') }}</b> : @{{ addresses.phone }}
<b>{{ __('shop::app.customer.account.address.index.contact') }}</b> :
<span v-text="addresses.phone"></span>
</li>
</ul>
</div>
</div>
<div id="message"></div>
<div class="control-group" :class="[errors.has('address-form.billing[address_id]') ? 'has-error' : '']">
<span class="control-error" v-if="errors.has('address-form.billing[address_id]')">
@{{ errors.first('address-form.billing[address_id]') }}
<span
class="control-error"
v-text="errors.first('address-form.billing[address_id]')"
v-if="errors.has('address-form.billing[address_id]')">
</span>
</div>
</div>
@ -60,6 +63,7 @@
<span class="checkbox">
<input type="checkbox" id="billing[use_for_shipping]" name="billing[use_for_shipping]" v-model="address.billing.use_for_shipping"/>
<label class="checkbox-view" for="billing[use_for_shipping]"></label>
{{ __('shop::app.checkout.onepage.use_for_shipping') }}
</span>
</div>
@ -67,13 +71,12 @@
</div>
<div class="form-container" v-if="this.new_billing_address">
<div class="form-header">
<h1>{{ __('shop::app.checkout.onepage.billing-address') }}</h1>
@auth('customer')
@if(count(auth('customer')->user()->addresses))
<a class="btn btn-lg btn-primary" @click = backToSavedBillingAddress()>
<a class="btn btn-lg btn-primary" @click="backToSavedBillingAddress()">
{{ __('shop::app.checkout.onepage.back') }}
</a>
@endif
@ -85,14 +88,23 @@
{{ __('shop::app.checkout.onepage.email') }}
</label>
<input type="text" v-validate="'required|email'" class="control" id="billing[email]" name="billing[email]" v-model="address.billing.email" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.email') }}&quot;" @blur="isCustomerExist"/>
<input
class="control"
id="billing[email]"
type="text"
name="billing[email]"
v-model="address.billing.email"
v-validate="'required|email'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.email') }}&quot;"
@blur="isCustomerExist"/>
<span class="control-error" v-if="errors.has('address-form.billing[email]')">
@{{ errors.first('address-form.billing[email]') }}
<span
class="control-error"
v-text="errors.first('address-form.billing[email]')"
v-if="errors.has('address-form.billing[email]')">
</span>
</div>
{{-- for customer login checkout --}}
@if (! auth()->guard('customer')->check())
@include('shop::checkout.onepage.customer-checkout')
@endif
@ -102,10 +114,18 @@
{{ __('shop::app.checkout.onepage.company-name') }}
</label>
<input type="text" class="control" id="billing[company_name]" name="billing[company_name]" v-model="address.billing.company_name" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.company-name') }}&quot;"/>
<input
class="control"
id="billing[company_name]"
type="text"
name="billing[company_name]"
v-model="address.billing.company_name"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.company-name') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.billing[company_name]')">
@{{ errors.first('address-form.billing[company_name]') }}
<span
class="control-error"
v-text="errors.first('address-form.billing[company_name]')"
v-if="errors.has('address-form.billing[company_name]')">
</span>
</div>
@ -114,10 +134,19 @@
{{ __('shop::app.checkout.onepage.first-name') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[first_name]" name="billing[first_name]" v-model="address.billing.first_name" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.first-name') }}&quot;"/>
<input
class="control"
id="billing[first_name]"
type="text"
name="billing[first_name]"
v-model="address.billing.first_name"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.first-name') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.billing[first_name]')">
@{{ errors.first('address-form.billing[first_name]') }}
<span
class="control-error"
v-text="errors.first('address-form.billing[first_name]')"
v-if="errors.has('address-form.billing[first_name]')">
</span>
</div>
@ -126,10 +155,19 @@
{{ __('shop::app.checkout.onepage.last-name') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[last_name]" name="billing[last_name]" v-model="address.billing.last_name" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.last-name') }}&quot;"/>
<input
class="control"
id="billing[last_name]"
type="text"
name="billing[last_name]"
v-model="address.billing.last_name"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.last-name') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.billing[last_name]')">
@{{ errors.first('address-form.billing[last_name]') }}
<span
class="control-error"
v-text="errors.first('address-form.billing[last_name]')"
v-if="errors.has('address-form.billing[last_name]')">
</span>
</div>
@ -138,17 +176,31 @@
{{ __('shop::app.checkout.onepage.address1') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing_address_0" name="billing[address1][]" v-model="address.billing.address1[0]" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.address1') }}&quot;"/>
<input
class="control"
id="billing_address_0"
type="text"
name="billing[address1][]"
v-model="address.billing.address1[0]"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.address1') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.billing[address1][]')">
@{{ errors.first('address-form.billing[address1][]') }}
<span
class="control-error"
v-text="errors.first('address-form.billing[address1][]')"
v-if="errors.has('address-form.billing[address1][]')">
</span>
</div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1)
<div class="control-group" style="margin-top: -25px;">
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
<input type="text" class="control" name="billing[address1][{{ $i }}]" id="billing_address_{{ $i }}" v-model="address.billing.address1[{{$i}}]">
<input
class="control"
id="billing_address_{{ $i }}"
type="text"
name="billing[address1][{{ $i }}]"
v-model="address.billing.address1[{{$i}}]">
@endfor
</div>
@endif
@ -158,64 +210,102 @@
{{ __('shop::app.checkout.onepage.city') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[city]" name="billing[city]" v-model="address.billing.city" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.city') }}&quot;"/>
<input
class="control"
id="billing[city]"
type="text"
name="billing[city]"
v-model="address.billing.city"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.city') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.billing[city]')">
@{{ errors.first('address-form.billing[city]') }}
<span
class="control-error"
v-text="errors.first('address-form.billing[city]')"
v-if="errors.has('address-form.billing[city]')">
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[country]') ? 'has-error' : '']">
<label for="billing[country]" class="required">
<label for="billing[country]" class="{{ core()->isCountryRequired() ? 'required' : '' }}">
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="billing[country]" name="billing[country]" v-model="address.billing.country" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<select
class="control"
id="billing[country]"
type="text"
name="billing[country]"
v-validate="'{{ core()->isCountryRequired() ? 'required' : '' }}'"
v-model="address.billing.country"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('address-form.billing[country]')">
@{{ errors.first('address-form.billing[country]') }}
<span
class="control-error"
v-text="errors.first('address-form.billing[country]')"
v-if="errors.has('address-form.billing[country]')">
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[state]') ? 'has-error' : '']">
<label for="billing[state]" class="required">
<label for="billing[state]" class="{{ core()->isStateRequired() ? 'required' : '' }}">
{{ __('shop::app.checkout.onepage.state') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[state]" name="billing[state]" v-model="address.billing.state" v-if="!haveStates('billing')" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.state') }}&quot;"/>
<select v-validate="'required'" class="control" id="billing[state]" name="billing[state]" v-model="address.billing.state" v-if="haveStates('billing')" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.state') }}&quot;">
<input
class="control"
id="billing[state]"
name="billing[state]"
type="text"
v-model="address.billing.state"
v-validate="'{{ core()->isStateRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.state') }}&quot;"
v-if="! haveStates('billing')"/>
<select
class="control"
id="billing[state]"
name="billing[state]"
v-model="address.billing.state"
v-validate=""
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.state') }}&quot;"
v-if="haveStates('billing')">
<option value="">{{ __('shop::app.checkout.onepage.select-state') }}</option>
<option v-for='(state, index) in countryStates[address.billing.country]' :value="state.code">
@{{ state.default_name }}
</option>
<option v-for='(state, index) in countryStates[address.billing.country]' :value="state.code" v-text="state.default_name"></option>
</select>
<span class="control-error" v-if="errors.has('address-form.billing[state]')">
@{{ errors.first('address-form.billing[state]') }}
<span
class="control-error"
v-text="errors.first('address-form.billing[state]')"
v-if="errors.has('address-form.billing[state]')">
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[postcode]') ? 'has-error' : '']">
<label for="billing[postcode]" class="required">
<label for="billing[postcode]" class="{{ core()->isPostCodeRequired() ? 'required' : '' }}">
{{ __('shop::app.checkout.onepage.postcode') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[postcode]" name="billing[postcode]" v-model="address.billing.postcode" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.postcode') }}&quot;"/>
<input
class="control"
id="billing[postcode]"
type="text"
name="billing[postcode]"
v-model="address.billing.postcode"
v-validate="'{{ core()->isPostCodeRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.postcode') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.billing[postcode]')">
@{{ errors.first('address-form.billing[postcode]') }}
<span
class="control-error"
v-text="errors.first('address-form.billing[postcode]')"
v-if="errors.has('address-form.billing[postcode]')">
</span>
</div>
@ -224,18 +314,32 @@
{{ __('shop::app.checkout.onepage.phone') }}
</label>
<input type="text" v-validate="'required|numeric'" class="control" id="billing[phone]" name="billing[phone]" v-model="address.billing.phone" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.phone') }}&quot;"/>
<input
class="control"
id="billing[phone]"
type="text"
name="billing[phone]"
v-validate="'required|numeric'"
v-model="address.billing.phone"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.phone') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.billing[phone]')">
@{{ errors.first('address-form.billing[phone]') }}
</span>
<span
class="control-error"
v-text="errors.first('address-form.billing[phone]')"
v-if="errors.has('address-form.billing[phone]')"></span>
</div>
@if ($cart->haveStockableItems())
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="billing[use_for_shipping]" name="billing[use_for_shipping]" v-model="address.billing.use_for_shipping"/>
<input
id="billing[use_for_shipping]"
type="checkbox"
name="billing[use_for_shipping]"
v-model="address.billing.use_for_shipping"/>
<label class="checkbox-view" for="billing[use_for_shipping]"></label>
{{ __('shop::app.checkout.onepage.use_for_shipping') }}
</span>
</div>
@ -244,21 +348,26 @@
@auth('customer')
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="billing[save_as_address]" name="billing[save_as_address]" v-model="address.billing.save_as_address"/>
<input
id="billing[save_as_address]"
type="checkbox"
name="billing[save_as_address]"
v-model="address.billing.save_as_address"/>
<label class="checkbox-view" for="billing[save_as_address]"></label>
{{ __('shop::app.checkout.onepage.save_as_address') }}
</span>
</div>
@endauth
</div>
@if ($cart->haveStockableItems())
<div class="form-container" v-if="!address.billing.use_for_shipping && !this.new_shipping_address">
<div class="form-container" v-if="! address.billing.use_for_shipping && ! this.new_shipping_address">
<div class="form-header mb-30">
<span class="checkout-step-heading">{{ __('shop::app.checkout.onepage.shipping-address') }}</span>
<a class="btn btn-lg btn-primary" @click=newShippingAddress()>
<a class="btn btn-lg btn-primary" @click="newShippingAddress()">
{{ __('shop::app.checkout.onepage.new-address') }}
</a>
</div>
@ -267,59 +376,65 @@
<div class="address-card" v-for='(addresses, index) in this.allAddress'>
<div class="checkout-address-content" style="display: flex; flex-direction: row; justify-content: space-between; width: 100%;">
<label class="radio-container" style="float: right; width: 10%;">
<input v-validate="'required'" type="radio" id="shipping[address_id]" name="shipping[address_id]" v-model="address.shipping.address_id" :value="addresses.id"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.shipping-address') }}&quot;">
<input
id="shipping[address_id]"
type="radio"
name="shipping[address_id]"
:value="addresses.id"
v-model="address.shipping.address_id"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.shipping-address') }}&quot;">
<span class="checkmark"></span>
</label>
<ul class="address-card-list" style="float: right; width: 85%;">
<li class="mb-5" v-if="addresses.company_name != ''">
@{{ addresses.company_name }}
</li>
<li class="mb-10">
<b>@{{ addresses.first_name }} @{{ addresses.last_name }},</b>
<b v-text="`${addresses.first_name} ${addresses.last_name}`"></b>
</li>
<li class="mb-5">
@{{ addresses.address1 }},
<li
class="mb-5"
v-text="addresses.company_name"
v-if="addresses.company_name != ''">
</li>
<li class="mb-5">
@{{ addresses.city }},
</li>
<li class="mb-5" v-text="addresses.address1"></li>
<li class="mb-5">
@{{ addresses.state }},
</li>
<li class="mb-5" v-text="addresses.city"></li>
<li class="mb-5" v-text="addresses.state"></li>
<li class="mb-15">
@{{ addresses.country }} @{{ addresses.postcode }}
<span v-text="addresses.country" v-if="addresses.country"></span>
<span v-text="addresses.postcode" v-if="addresses.postcode"></span>
</li>
<li>
<b>{{ __('shop::app.customer.account.address.index.contact') }}</b> : @{{ addresses.phone }}
<b>{{ __('shop::app.customer.account.address.index.contact') }}</b> :
<span v-text="addresses.phone"></span>
</li>
</ul>
</div>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[address_id]') ? 'has-error' : '']">
<span class="control-error" v-if="errors.has('address-form.shipping[address_id]')">
@{{ errors.first('address-form.shipping[address_id]') }}
<span
class="control-error"
v-text="errors.first('address-form.shipping[address_id]')"
v-if="errors.has('address-form.shipping[address_id]')">
</span>
</div>
</div>
</div>
<div class="form-container" v-if="!address.billing.use_for_shipping && this.new_shipping_address">
<div class="form-container" v-if="! address.billing.use_for_shipping && this.new_shipping_address">
<div class="form-header">
<h1>{{ __('shop::app.checkout.onepage.shipping-address') }}</h1>
@auth('customer')
@if(count(auth('customer')->user()->addresses))
<a class="btn btn-lg btn-primary" @click = backToSavedShippingAddress()>
<a class="btn btn-lg btn-primary" @click="backToSavedShippingAddress()">
{{ __('shop::app.checkout.onepage.back') }}
</a>
@endif
@ -331,10 +446,19 @@
{{ __('shop::app.checkout.onepage.first-name') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[first_name]" name="shipping[first_name]" v-model="address.shipping.first_name" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.first-name') }}&quot;"/>
<input
class="control"
id="shipping[first_name]"
type="text"
name="shipping[first_name]"
v-model="address.shipping.first_name"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.first-name') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.shipping[first_name]')">
@{{ errors.first('address-form.shipping[first_name]') }}
<span
class="control-error"
v-text="errors.first('address-form.shipping[first_name]')"
v-if="errors.has('address-form.shipping[first_name]')">
</span>
</div>
@ -343,10 +467,19 @@
{{ __('shop::app.checkout.onepage.last-name') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[last_name]" name="shipping[last_name]" v-model="address.shipping.last_name" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.last-name') }}&quot;"/>
<input
class="control"
id="shipping[last_name]"
type="text"
name="shipping[last_name]"
v-model="address.shipping.last_name"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.last-name') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.shipping[last_name]')">
@{{ errors.first('address-form.shipping[last_name]') }}
<span
class="control-error"
v-text="errors.first('address-form.shipping[last_name]')"
v-if="errors.has('address-form.shipping[last_name]')">
</span>
</div>
@ -355,10 +488,19 @@
{{ __('shop::app.checkout.onepage.email') }}
</label>
<input type="text" v-validate="'required|email'" class="control" id="shipping[email]" name="shipping[email]" v-model="address.shipping.email" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.email') }}&quot;"/>
<input
class="control"
id="shipping[email]"
type="text"
name="shipping[email]"
v-validate="'required|email'"
v-model="address.shipping.email"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.email') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.shipping[email]')">
@{{ errors.first('address-form.shipping[email]') }}
<span
class="control-error"
v-text="errors.first('address-form.shipping[email]')"
v-if="errors.has('address-form.shipping[email]')">
</span>
</div>
@ -367,17 +509,31 @@
{{ __('shop::app.checkout.onepage.address1') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping_address_0" name="shipping[address1][]" v-model="address.shipping.address1[0]" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.address1') }}&quot;"/>
<input
class="control"
id="shipping_address_0"
type="text"
name="shipping[address1][]"
v-model="address.shipping.address1[0]"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.address1') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.shipping[address1][]')">
@{{ errors.first('address-form.shipping[address1][]') }}
<span
class="control-error"
v-text="errors.first('address-form.shipping[address1][]')"
v-if="errors.has('address-form.shipping[address1][]')">
</span>
</div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1)
<div class="control-group" style="margin-top: -25px;">
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
<input type="text" class="control" name="shipping[address1][{{ $i }}]" id="shipping_address_{{ $i }}" v-model="address.shipping.address1[{{$i}}]">
<input
class="control"
id="shipping_address_{{ $i }}"
type="text"
name="shipping[address1][{{ $i }}]"
v-model="address.shipping.address1[{{$i}}]">
@endfor
</div>
@endif
@ -387,19 +543,35 @@
{{ __('shop::app.checkout.onepage.city') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[city]" name="shipping[city]" v-model="address.shipping.city" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.city') }}&quot;"/>
<input
class="control"
id="shipping[city]"
type="text"
name="shipping[city]"
v-model="address.shipping.city"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.city') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.shipping[city]')">
@{{ errors.first('address-form.shipping[city]') }}
<span
class="control-error"
v-text="errors.first('address-form.shipping[city]')"
v-if="errors.has('address-form.shipping[city]')">
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[country]') ? 'has-error' : '']">
<label for="shipping[country]" class="required">
<label for="shipping[country]" class="{{ core()->isCountryRequired() ? 'required' : '' }}">
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="shipping[country]" name="shipping[country]" v-model="address.shipping.country" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<select
class="control"
id="shipping[country]"
type="text"
name="shipping[country]"
v-model="address.shipping.country"
v-validate="'{{ core()->isCountryRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
@ -407,43 +579,67 @@
@endforeach
</select>
<span class="control-error" v-if="errors.has('address-form.shipping[country]')">
@{{ errors.first('address-form.shipping[country]') }}
<span
class="control-error"
v-text="errors.first('address-form.shipping[country]')"
v-if="errors.has('address-form.shipping[country]')">
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[state]') ? 'has-error' : '']">
<label for="shipping[state]" class="required">
<label for="shipping[state]" class="{{ core()->isStateRequired() ? 'required' : '' }}">
{{ __('shop::app.checkout.onepage.state') }}
</label>
<input
class="control"
id="shipping[state]"
type="text"
name="shipping[state]"
v-model="address.shipping.state"
v-validate="'{{ core()->isStateRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.state') }}&quot;"
v-if="! haveStates('shipping')"/>
<input type="text" v-validate="'required'" class="control" id="shipping[state]" name="shipping[state]" v-model="address.shipping.state" v-if="!haveStates('shipping')" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.state') }}&quot;"/>
<select v-validate="'required'" class="control" id="shipping[state]" name="shipping[state]" v-model="address.shipping.state" v-if="haveStates('shipping')" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.state') }}&quot;">
<select
class="control" id="shipping[state]"
name="shipping[state]"
v-model="address.shipping.state"
v-validate=""
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.state') }}&quot;"
v-if="haveStates('shipping')">
<option value="">{{ __('shop::app.checkout.onepage.select-state') }}</option>
<option v-for='(state, index) in countryStates[address.shipping.country]' :value="state.code">
@{{ state.default_name }}
</option>
</select>
<span class="control-error" v-if="errors.has('address-form.shipping[state]')">
@{{ errors.first('address-form.shipping[state]') }}
<span
class="control-error"
v-text="errors.first('address-form.shipping[state]')"
v-if="errors.has('address-form.shipping[state]')">
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[postcode]') ? 'has-error' : '']">
<label for="shipping[postcode]" class="required">
<label for="shipping[postcode]" class="{{ core()->isPostCodeRequired() ? 'required' : '' }}">
{{ __('shop::app.checkout.onepage.postcode') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[postcode]" name="shipping[postcode]" v-model="address.shipping.postcode" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.postcode') }}&quot;"/>
<input
class="control"
id="shipping[postcode]"
type="text"
name="shipping[postcode]"
v-model="address.shipping.postcode"
v-validate="'{{ core()->isPostCodeRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.postcode') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.shipping[postcode]')">
@{{ errors.first('address-form.shipping[postcode]') }}
<span
class="control-error"
v-text="errors.first('address-form.shipping[postcode]')"
v-if="errors.has('address-form.shipping[postcode]')">
</span>
</div>
@ -452,24 +648,37 @@
{{ __('shop::app.checkout.onepage.phone') }}
</label>
<input type="text" v-validate="'required|numeric'" class="control" id="shipping[phone]" name="shipping[phone]" v-model="address.shipping.phone" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.phone') }}&quot;"/>
<input
class="control"
id="shipping[phone]"
type="text"
name="shipping[phone]"
v-model="address.shipping.phone"
v-validate="'required|numeric'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.phone') }}&quot;"/>
<span class="control-error" v-if="errors.has('address-form.shipping[phone]')">
@{{ errors.first('address-form.shipping[phone]') }}
<span
class="control-error"
v-text="errors.first('address-form.shipping[phone]')"
v-if="errors.has('address-form.shipping[phone]')">
</span>
</div>
@auth('customer')
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="shipping[save_as_address]" name="shipping[save_as_address]" v-model="address.shipping.save_as_address"/>
<input
id="shipping[save_as_address]"
type="checkbox"
name="shipping[save_as_address]"
v-model="address.shipping.save_as_address"/>
<label class="checkbox-view" for="shipping[save_as_address]"></label>
{{ __('shop::app.checkout.onepage.save_as_address') }}
</span>
</div>
@endauth
</div>
@endif
</form>
</form>

View File

@ -4,36 +4,60 @@
<script type="text/x-template" id="country-state-template">
<div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country" class="required">
<label for="country" class="{{ core()->isCountryRequired() ? 'required' : '' }}">
{{ __('shop::app.customer.account.address.create.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="country" name="country" v-model="country" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.country') }}&quot;">
<select
class="control"
id="country"
type="text"
name="country"
v-model="country"
v-validate="'{{ core()->isCountryRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
<option {{ $country->code === $defaultCountry ? 'selected' : '' }} value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('country')">
@{{ errors.first('country') }}
<span
class="control-error"
v-text="errors.first('country')"
v-if="errors.has('country')">
</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state" class="required">
<label for="state" class="{{ core()->isStateRequired() ? 'required' : '' }}">
{{ __('shop::app.customer.account.address.create.state') }}
</label>
<input type="text" v-validate="'required'" class="control" id="state" name="state" v-model="state" v-if="!haveStates()" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.state') }}&quot;"/>
<select v-validate="'required'" class="control" id="state" name="state" v-model="state" v-if="haveStates()" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.state') }}&quot;">
<input
class="control"
id="state"
type="text"
name="state"
v-model="state"
v-validate="'{{ core()->isStateRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.state') }}&quot;"
v-if="! haveStates()"/>
<select
class="control"
id="state"
name="state"
v-model="state"
v-validate="'{{ core()->isStateRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.state') }}&quot;"
v-if="haveStates()">
<option value="">{{ __('shop::app.customer.account.address.create.select-state') }}</option>
<option v-for='(state, index) in countryStates[country]' :value="state.code">
@{{ state.default_name }}
</option>
</select>
<span class="control-error" v-if="errors.has('state')">
@ -45,7 +69,6 @@
<script>
Vue.component('country-state', {
template: '#country-state-template',
inject: ['$validator'],
@ -70,4 +93,4 @@
}
});
</script>
@endpush
@endpush

View File

@ -11,7 +11,9 @@
@section('account-content')
<div class="account-layout">
<div class="account-head mb-15">
<span class="back-icon"><a href="{{ route('customer.address.index') }}"><i class="icon icon-menu-back"></i></a></span>
<span class="back-icon">
<a href="{{ route('customer.address.index') }}"><i class="icon icon-menu-back"></i></a>
</span>
<span class="account-heading">{{ __('shop::app.customer.account.address.create.title') }}</span>
@ -29,9 +31,18 @@
<div class="control-group" :class="[errors.has('company_name') ? 'has-error' : '']">
<label for="company_name">{{ __('shop::app.customer.account.address.create.company_name') }}</label>
<input value="{{ old('company_name') }}" type="text" class="control" name="company_name" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.company_name') }}&quot;">
<input
class="control"
type="text"
name="company_name"
value="{{ old('company_name') }}"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.company_name') }}&quot;">
<span class="control-error" v-if="errors.has('company_name')">@{{ errors.first('company_name') }}</span>
<span
class="control-error"
v-text="errors.first('company_name')"
v-if="errors.has('company_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.company_name.after') !!}
@ -39,9 +50,19 @@
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name" class="required">{{ __('shop::app.customer.account.address.create.first_name') }}</label>
<input value="{{ old('first_name') ?? $currentCustomer->first_name }}" type="text" class="control" name="first_name" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.first_name') }}&quot;">
<input
class="control"
type="text"
name="first_name"
value="{{ old('first_name') ?? $currentCustomer->first_name }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.first_name') }}&quot;">
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
<span
class="control-error"
v-text="errors.first('first_name')"
v-if="errors.has('first_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.first_name.after') !!}
@ -49,9 +70,19 @@
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name" class="required">{{ __('shop::app.customer.account.address.create.last_name') }}</label>
<input value="{{ old('last_name') ?? $currentCustomer->last_name }}" type="text" class="control" name="last_name" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.last_name') }}&quot;">
<input
class="control"
type="text"
name="last_name"
value="{{ old('last_name') ?? $currentCustomer->last_name }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.last_name') }}&quot;">
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
<span
class="control-error"
v-text="errors.first('last_name')"
v-if="errors.has('last_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.last_name.after') !!}
@ -69,7 +100,11 @@
v-validate="''"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.vat_id') }}&quot;">
<span class="control-error" v-if="errors.has('vat_id')">@{{ errors.first('vat_id') }}</span>
<span
class="control-error"
v-text="errors.first('vat_id')"
v-if="errors.has('vat_id')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.vat_id.after') !!}
@ -81,41 +116,75 @@
<div class="control-group {{ $errors->has('address1.*') ? 'has-error' : '' }}">
<label for="address1" class="required">{{ __('shop::app.customer.account.address.create.street-address') }}</label>
<input type="text" class="control" name="address1[]" value="{{ $addresses[0] ?? '' }}" id="address1" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.street-address') }}&quot;">
<input
class="control"
id="address1"
type="text"
name="address1[]"
value="{{ $addresses[0] ?? '' }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.street-address') }}&quot;">
<span class="control-error" v-text="'{{ $errors->first('address1.*') }}'"></span>
<span
class="control-error"
v-text="'{{ $errors->first('address1.*') }}'">
</span>
</div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1)
<div class="control-group" style="margin-top: -25px;">
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
<input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}">
<input
class="control"
id="address_{{ $i }}"
type="text"
name="address1[{{ $i }}]">
@endfor
</div>
@endif
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.street-address.after') !!}
@include ('shop::customers.account.address.country-state', ['countryCode' => old('country'), 'stateCode' => old('state')])
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.country-state.after') !!}
<div class="control-group" :class="[errors.has('city') ? 'has-error' : '']">
<label for="city" class="required">{{ __('shop::app.customer.account.address.create.city') }}</label>
<input value="{{ old('city') }}" type="text" class="control" name="city" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.city') }}&quot;">
<input
class="control"
type="text"
name="city"
value="{{ old('city') }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.city') }}&quot;">
<span class="control-error" v-if="errors.has('city')">@{{ errors.first('city') }}</span>
<span
class="control-error"
v-text="errors.first('city')"
v-if="errors.has('city')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.city.after') !!}
@include ('shop::customers.account.address.country-state', ['countryCode' => old('country'), 'stateCode' => old('state')])
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.country-state.after') !!}
<div class="control-group" :class="[errors.has('postcode') ? 'has-error' : '']">
<label for="postcode" class="required">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<label for="postcode" class="{{ core()->isPostCodeRequired() ? 'required' : '' }}">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<input value="{{ old('postcode') }}" type="text" class="control" name="postcode" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.postcode') }}&quot;">
<input
class="control"
type="text"
name="postcode"
value="{{ old('postcode') }}"
v-validate="'{{ core()->isPostCodeRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.postcode') }}&quot;">
<span class="control-error" v-if="errors.has('postcode')">@{{ errors.first('postcode') }}</span>
<span
class="control-error"
v-text="errors.first('postcode')"
v-if="errors.has('postcode')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.postcode.after') !!}
@ -123,16 +192,29 @@
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone" class="required">{{ __('shop::app.customer.account.address.create.phone') }}</label>
<input value="{{ old('phone') }}" type="text" class="control" name="phone" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.phone') }}&quot;">
<input
class="control"
type="text"
name="phone"
value="{{ old('phone') }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.phone') }}&quot;">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
<span
class="control-error"
v-text="errors.first('phone')"
v-if="errors.has('phone')"></span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.after') !!}
<div class="control-group">
<span class="checkbox">
<input type="checkbox" class="control" id="default_address" name="default_address" {{ old('default_address') ? 'checked' : '' }} >
<input
class="control"
id="default_address"
type="checkbox"
name="default_address" {{ old('default_address') ? 'checked' : '' }} >
<label class="checkbox-view" for="default_address"></label>
@ -148,4 +230,4 @@
{!! view_render_event('bagisto.shop.customers.account.address.create.after') !!}
</div>
@endsection
@endsection

View File

@ -7,7 +7,9 @@
@section('account-content')
<div class="account-layout">
<div class="account-head mb-15">
<span class="back-icon"><a href="{{ route('customer.address.index') }}"><i class="icon icon-menu-back"></i></a></span>
<span class="back-icon">
<a href="{{ route('customer.address.index') }}"><i class="icon icon-menu-back"></i></a>
</span>
<span class="account-heading">{{ __('shop::app.customer.account.address.edit.title') }}</span>
@ -28,9 +30,18 @@
<div class="control-group" :class="[errors.has('company_name') ? 'has-error' : '']">
<label for="company_name">{{ __('shop::app.customer.account.address.edit.company_name') }}</label>
<input type="text" value="{{ old('company_name') ?: $address->company_name }}" class="control" name="company_name" data-vv-as="&quot;{{ __('shop::app.customer.account.address.edit.company_name') }}&quot;">
<input
class="control"
type="text"
name="company_name"
value="{{ old('company_name') ?: $address->company_name }}"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.edit.company_name') }}&quot;">
<span class="control-error" v-if="errors.has('company_name')">@{{ errors.first('company_name') }}</span>
<span
class="control-error"
v-text="errors.first('company_name')"
v-if="errors.has('company_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.company_name.after') !!}
@ -38,9 +49,19 @@
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name" class="required">{{ __('shop::app.customer.account.address.create.first_name') }}</label>
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{ old('first_name') ?: $address->first_name }}" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.first_name') }}&quot;">
<input
class="control"
type="text"
name="first_name"
value="{{ old('first_name') ?: $address->first_name }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.first_name') }}&quot;">
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
<span
class="control-error"
v-text="errors.first('first_name')"
v-if="errors.has('first_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.first_name.after') !!}
@ -48,9 +69,19 @@
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name" class="required">{{ __('shop::app.customer.account.address.create.last_name') }}</label>
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{ old('last_name') ?: $address->last_name }}" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.last_name') }}&quot;">
<input
class="control"
type="text"
name="last_name"
value="{{ old('last_name') ?: $address->last_name }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.last_name') }}&quot;">
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
<span
class="control-error"
v-text="errors.first('last_name')"
v-if="errors.has('last_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.last_name.after') !!}
@ -61,13 +92,18 @@
</label>
<input
type="text"
class="control"
type="text"
name="vat_id"
value="{{ old('vat_id') ?: $address->vat_id }}"
v-validate="''" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.vat_id') }}&quot;">
v-validate="''"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.vat_id') }}&quot;">
<span class="control-error" v-if="errors.has('vat_id')">@{{ errors.first('vat_id') }}</span>
<span
class="control-error"
v-text="errors.first('vat_id')"
v-if="errors.has('vat_id')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.vat_id.after') !!}
@ -77,7 +113,14 @@
<div class="control-group {{ $errors->has('address1.*') ? 'has-error' : '' }}">
<label for="address_0" class="required">{{ __('shop::app.customer.account.address.edit.street-address') }}</label>
<input type="text" class="control" name="address1[]" id="address_0" v-validate="'required'" value="{{ $addresses[0] ?? '' }}" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.street-address') }}&quot;">
<input
class="control"
id="address_0"
type="text"
name="address1[]"
value="{{ $addresses[0] ?? '' }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.street-address') }}&quot;">
<span class="control-error">{{ $errors->first('address1.*') }}</span>
</div>
@ -85,33 +128,58 @@
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1)
<div class="control-group" style="margin-top: -25px;">
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
<input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}" value="{{ $addresses[$i] ?? '' }}">
<input
class="control"
id="address_{{ $i }}"
type="text"
name="address1[{{ $i }}]"
value="{{ $addresses[$i] ?? '' }}">
@endfor
</div>
@endif
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.street-addres.after') !!}
@include ('shop::customers.account.address.country-state', ['countryCode' => old('country') ?? $address->country, 'stateCode' => old('state') ?? $address->state])
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.country-state.after') !!}
<div class="control-group" :class="[errors.has('city') ? 'has-error' : '']">
<label for="city" class="required">{{ __('shop::app.customer.account.address.create.city') }}</label>
<input type="text" class="control" name="city" v-validate="'required|regex:^[a-zA-Z \-]*$'" value="{{ old('city') ?: $address->city }}" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.city') }}&quot;">
<input
class="control"
type="text"
name="city"
value="{{ old('city') ?: $address->city }}"
v-validate="'required|regex:^[a-zA-Z \-]*$'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.city') }}&quot;">
<span class="control-error" v-if="errors.has('city')">@{{ errors.first('city') }}</span>
<span
class="control-error"
v-text="errors.first('city')"
v-if="errors.has('city')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.create.after') !!}
@include ('shop::customers.account.address.country-state', ['countryCode' => old('country') ?? $address->country, 'stateCode' => old('state') ?? $address->state])
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.country-state.after') !!}
<div class="control-group" :class="[errors.has('postcode') ? 'has-error' : '']">
<label for="postcode" class="required">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<label for="postcode" class="{{ core()->isPostCodeRequired() ? 'required' : '' }}">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<input type="text" class="control" name="postcode" v-validate="'required'" value="{{ old('postcode') ?: $address->postcode }}" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.postcode') }}&quot;">
<input
type="text"
class="control"
name="postcode"
v-validate="'{{ core()->isPostCodeRequired() ? 'required' : '' }}'"
value="{{ old('postcode') ?: $address->postcode }}"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.postcode') }}&quot;">
<span class="control-error" v-if="errors.has('postcode')">@{{ errors.first('postcode') }}</span>
<span
class="control-error"
v-text="errors.first('postcode')"
v-if="errors.has('postcode')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.postcode.after') !!}
@ -119,16 +187,31 @@
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone" class="required">{{ __('shop::app.customer.account.address.create.phone') }}</label>
<input type="text" class="control" name="phone" v-validate="'required'" value="{{ old('phone') ?: $address->phone }}" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.phone') }}&quot;">
<input
class="control"
type="text"
name="phone"
value="{{ old('phone') ?: $address->phone }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.phone') }}&quot;">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
<span
class="control-error"
v-text="errors.first('phone')"
v-if="errors.has('phone')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.after', ['address' => $address]) !!}
<div class="control-group">
<span class="checkbox">
<input type="checkbox" class="control" id="default_address" name="default_address" {{ $address->default_address ? 'checked' : '' }} >
<input
class="control"
id="default_address"
type="checkbox"
name="default_address"
{{ $address->default_address ? 'checked' : '' }}>
<label class="checkbox-view" for="default_address"></label>
@ -146,4 +229,4 @@
{!! view_render_event('bagisto.shop.customers.account.address.edit.after', ['address' => $address]) !!}
</div>
@endsection
@endsection

View File

@ -56,7 +56,7 @@
</li>
<li class="mt-5">
{{ $address->address1 }},
{{ $address->address1 }}
</li>
<li class="mt-5">
@ -91,6 +91,7 @@
<form id="deleteAddressForm" action="{{ route('address.delete', $address->id) }}" method="post">
@method('delete')
@csrf
</form>
</span>

View File

@ -5,7 +5,12 @@ return [
'key' => 'taxes',
'name' => 'tax::app.admin.system.taxes.taxes',
'sort' => 6,
], [
],
/**
* Catalog.
*/
[
'key' => 'taxes.catalogue',
'name' => 'tax::app.admin.system.taxes.catalogue',
'sort' => 1,
@ -15,12 +20,12 @@ return [
'sort' => 1,
'fields' => [
[
'name' => 'tax_inclusive',
'title' => 'tax::app.admin.system.taxes.tax-inclusive',
'type' => 'boolean',
'name' => 'tax_inclusive',
'title' => 'tax::app.admin.system.taxes.tax-inclusive',
'type' => 'boolean',
'validation' => 'required',
'default' => false
]
'default' => false,
],
],
], [
'key' => 'taxes.catalogue.default-location-calculation',
@ -44,7 +49,7 @@ return [
'title' => 'tax::app.admin.system.taxes.default-post-code',
'type' => 'text',
'default' => '',
]
],
],
]
];
],
];

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
"/js/velocity.js": "/js/velocity.js?id=ac05caeb5e4b0566a4ab",
"/js/manifest.js": "/js/manifest.js?id=3cded37ef514b0fb89b1",
"/js/components.js": "/js/components.js?id=d16d70d3905f32644901",
"/css/velocity.css": "/css/velocity.css?id=4ec74ee99bea554c475f",
"/css/velocity.css": "/css/velocity.css?id=1a21fa2c015a3f30dc05",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=b67a82956e53163b5e3f",
"/images/icon-calendar.svg": "/images/icon-calendar.svg?id=870d0f733a5837742276",
"/images/icon-camera.svg": "/images/icon-camera.svg?id=b2fd2f9e17e1ccee96e2",

View File

@ -957,12 +957,6 @@
.card {
height: 100%;
ul {
li {
display: inline-block;
}
}
}
}
@ -1342,12 +1336,6 @@
font-size: 14px;
}
ul {
li {
display: inline-block;
}
}
.add-address-button {
height: 100%;
display: table;
@ -2489,7 +2477,7 @@
}
@media only screen and (max-width: 425px) {
.cart-details {
.cart-content {

View File

@ -27,34 +27,30 @@
class="step-content shipping"
id="shipping-section"
v-if="showShippingSection">
<shipping-section
:key="shippingComponentKey"
@onShippingMethodSelected="shippingMethodSelected($event)">
</shipping-section>
</div>
<div
class="step-content payment"
v-if="showPaymentSection"
id="payment-section">
<payment-section @onPaymentMethodSelected="paymentMethodSelected($event)">
id="payment-section"
v-if="showPaymentSection">
<payment-section
@onPaymentMethodSelected="paymentMethodSelected($event)">
</payment-section>
<coupon-component
@onApplyCoupon="getOrderSummary"
@onRemoveCoupon="getOrderSummary">
</coupon-component>
</div>
<div
class="step-content review"
v-if="showSummarySection"
id="summary-section">
id="summary-section"
v-if="showSummarySection">
<review-section :key="reviewComponentKey">
<div slot="summary-section">
<summary-section
@ -79,7 +75,6 @@
</div>
</div>
</review-section>
</div>
</div>
@ -296,7 +291,13 @@
if (value == ""
&& element.id != 'sign-btn'
&& element.id != 'billing[company_name]'
&& element.id != 'billing[country]'
&& element.id != 'billing[state]'
&& element.id != 'billing[postcode]'
&& element.id != 'shipping[company_name]'
&& element.id != 'shipping[country]'
&& element.id != 'shipping[state]'
&& element.id != 'shipping[postcode]'
) {
// check for multiple line address
if (elementId.match('billing_address_')

View File

@ -1,5 +1,5 @@
<form data-vv-scope="address-form" class="custom-form">
<div class="form-container" v-if="!this.new_billing_address">
<div class="form-container" v-if="! this.new_billing_address">
<accordian
:active="true"
:title="'{{ __('shop::app.checkout.onepage.billing-address') }}'">
@ -8,6 +8,7 @@
<h3 class="fw6 display-inbl">
{{ __('shop::app.checkout.onepage.billing-address') }}
</h3>
<i class="rango-arrow"></i>
</div>
@ -19,34 +20,31 @@
v-for='(addresses, index) in this.allAddress'>
<div class="card">
<div class="card-body row">
<div class="col-1">
<input
type="radio"
v-validate="'required'"
name="billing[address_id]"
:value="addresses.id"
v-model="address.billing.address_id"
@change="validateForm('address-form')"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.billing-address') }}&quot;" />
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.billing-address') }}&quot;"
@change="validateForm('address-form')" />
<span class="checkmark"></span>
</div>
<div class="col-10">
<h5 class="card-title fw6">
@{{ addresses.first_name }} @{{ addresses.last_name }},
</h5>
<h5 class="card-title fw6" v-text="`${addresses.first_name} ${addresses.last_name}`"></h5>
<ul type="none">
<li>@{{ addresses.address1 }},</li>
<li>@{{ addresses.postcode }} @{{ addresses.city }},</li>
<li>@{{ addresses.state }},</li>
<li>@{{ addresses.country }}</li>
<li v-text="addresses.address1"></li>
<li v-text="addresses.city"></li>
<li v-text="addresses.state"></li>
<li>
{{ __('shop::app.customer.account.address.index.contact') }} : @{{ addresses.phone }}
<span v-text="addresses.country"></span>
<span v-text="addresses.postcode"></span>
</li>
<li>{{ __('shop::app.customer.account.address.index.contact') }} : @{{ addresses.phone }}</li>
</ul>
</div>
</div>
@ -59,9 +57,8 @@
@click="validateFormAfterAction"
class="card-body add-address-button">
<div class="cursor-pointer" @click="newBillingAddress()">
<i class="material-icons">
add_circle_outline
</i>
<i class="material-icons">add_circle_outline</i>
<span>{{ __('shop::app.checkout.onepage.new-address') }}</span>
</div>
</div>
@ -81,11 +78,11 @@
<div class="mt10 mb10" v-if="address.billing.address_id">
<span class="checkbox fs16 display-inbl">
<input
type="checkbox"
id="billing[use_for_shipping]"
type="checkbox"
name="billing[use_for_shipping]"
@change="validateFormAfterAction"
v-model="address.billing.use_for_shipping" />
v-model="address.billing.use_for_shipping"
@change="validateFormAfterAction" />
<span>
{{ __('shop::app.checkout.onepage.use_for_shipping') }}
@ -101,13 +98,12 @@
<accordian :title="'{{ __('shop::app.checkout.onepage.billing-address') }}'" :active="true">
<div class="form-header" slot="header">
<h3 class="fw6 display-inbl">
{{ __('shop::app.checkout.onepage.billing-address') }}
{{ __('shop::app.checkout.onepage.billing-address') }}
</h3>
<i class="rango-arrow"></i>
</div>
<div class="col-12 no-padding" slot="body">
@auth('customer')
@if(count(auth('customer')->user()->addresses))
@ -120,9 +116,7 @@
@endif
@endauth
@include('shop::checkout.onepage.customer-new-form', [
'billing' => true
])
@include('shop::checkout.onepage.customer-new-form', ['billing' => true])
</div>
</accordian>
</div>
@ -130,7 +124,7 @@
@if ($cart->haveStockableItems())
<div
class="form-container"
v-if="!address.billing.use_for_shipping && !this.new_shipping_address">
v-if="! address.billing.use_for_shipping && ! this.new_shipping_address">
<accordian
:active="true"
@ -140,6 +134,7 @@
<h3 class="fw6 display-inbl">
{{ __('shop::app.checkout.onepage.shipping-address') }}
</h3>
<i class="rango-arrow"></i>
</div>
@ -153,29 +148,28 @@
<div class="col-1">
<input
type="radio"
v-validate="'required'"
:value="addresses.id"
name="shipping[address_id]"
:value="addresses.id"
v-model="address.shipping.address_id"
@change="validateForm('address-form')"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.shipping-address') }}&quot;" />
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.shipping-address') }}&quot;"
@change="validateForm('address-form')" />
<span class="checkmark"></span>
</div>
<div class="col-10">
<h5 class="card-title fw6">
@{{ addresses.first_name }} @{{ addresses.last_name }},
</h5>
<h5 class="card-title fw6" v-text="`${addresses.first_name} ${addresses.last_name}`"></h5>
<ul type="none">
<li>@{{ addresses.address1 }},</li>
<li>@{{ addresses.city }},</li>
<li>@{{ addresses.state }},</li>
<li>@{{ addresses.country }} @{{ addresses.postcode }}</li>
<li v-text="addresses.address1"></li>
<li v-text="addresses.city"></li>
<li v-text="addresses.state"></li>
<li>
{{ __('shop::app.customer.account.address.index.contact') }} : @{{ addresses.phone }}
<span v-text="addresses.country"></span>
<span v-text="addresses.postcode"></span>
</li>
<li>{{ __('shop::app.customer.account.address.index.contact') }} : @{{ addresses.phone }}</li>
</ul>
</div>
</div>
@ -191,6 +185,7 @@
<i class="material-icons">
add_circle_outline
</i>
<span>{{ __('shop::app.checkout.onepage.new-address') }}</span>
</div>
</div>
@ -206,7 +201,7 @@
<div
class="form-container"
v-if="!address.billing.use_for_shipping && this.new_shipping_address">
v-if="! address.billing.use_for_shipping && this.new_shipping_address">
<accordian
:active="true"
@ -216,6 +211,7 @@
<h3 class="fw6 display-inbl">
{{ __('shop::app.checkout.onepage.shipping-address') }}
</h3>
<i class="rango-arrow"></i>
</div>
@ -231,9 +227,7 @@
@endif
@endauth
@include('shop::checkout.onepage.customer-new-form', [
'shipping' => true
])
@include('shop::checkout.onepage.customer-new-form', ['shipping' => true])
</div>
</accordian>
</div>

View File

@ -1,16 +1,23 @@
<country-state></country-state>
@push('scripts')
<script type="text/x-template" id="country-state-template">
<div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country" class="mandatory">
<label for="country" class="{{ core()->isCountryRequired() ? 'mandatory' : '' }}">
{{ __('shop::app.customer.account.address.create.country') }}
</label>
<select type="text" v-validate="'required'" class="control styled-select" id="country" name="country" v-model="country" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.country') }}&quot;">
<option value=""></option>
<select
class="control styled-select"
id="country"
type="text"
name="country"
v-model="country"
v-validate="'{{ core()->isCountryRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.country') }}&quot;">
<option value="">{{ __('Select Country') }}</option>
@foreach (core()->countries() as $country)
<option {{ $country->code === $defaultCountry ? 'selected' : '' }} value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
@ -20,31 +27,35 @@
<span class="select-icon rango-arrow-down"></span>
</div>
<span class="control-error" v-if="errors.has('country')" v-text="errors.first('country')"></span>
<span
class="control-error"
v-text="errors.first('country')"
v-if="errors.has('country')">
</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state" class="mandatory">
<label for="state" class="{{ core()->isStateRequired() ? 'mandatory' : '' }}">
{{ __('shop::app.customer.account.address.create.state') }}
</label>
<input
class="control"
id="state"
type="text"
name="state"
v-model="state"
class="control"
v-if="!haveStates()"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.state') }}&quot;" />
v-validate="'{{ core()->isStateRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.state') }}&quot;"
v-if="! haveStates()"/>
<template v-if="haveStates()">
<select
class="styled-select"
id="state"
name="state"
v-model="state"
class="styled-select"
v-validate="'required'"
v-validate="'{{ core()->isStateRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.state') }}&quot;">
<option value="">{{ __('shop::app.customer.account.address.create.select-state') }}</option>
@ -59,19 +70,22 @@
</div>
</template>
<span class="control-error" v-if="errors.has('state')" v-text="errors.first('state')"></span>
<span
class="control-error"
v-text="errors.first('state')"
v-if="errors.has('state')">
</span>
</div>
</div>
</script>
<script>
Vue.component('country-state', {
template: '#country-state-template',
inject: ['$validator'],
data() {
data: function () {
return {
country: "{{ $countryCode ?? $defaultCountry }}",
@ -82,7 +96,7 @@
},
methods: {
haveStates() {
haveStates: function () {
if (this.countryStates[this.country] && this.countryStates[this.country].length)
return true;

View File

@ -24,9 +24,18 @@
<div class="control-group" :class="[errors.has('company_name') ? 'has-error' : '']">
<label for="company_name">{{ __('shop::app.customer.account.address.create.company_name') }}</label>
<input type="text" class="control" name="company_name" value="{{ old('company_name') }}" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.company_name') }}&quot;">
<input
class="control"
type="text"
name="company_name"
value="{{ old('company_name') }}"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.company_name') }}&quot;">
<span class="control-error" v-if="errors.has('company_name')" v-text="errors.first('company_name')"></span>
<span
class="control-error"
v-text="errors.first('company_name')"
v-if="errors.has('company_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.company_name.after') !!}
@ -34,9 +43,19 @@
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name" class="mandatory">{{ __('shop::app.customer.account.address.create.first_name') }}</label>
<input type="text" class="control" name="first_name" value="{{ old('first_name') ?? $currentCustomer->first_name }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.first_name') }}&quot;">
<input
class="control"
type="text"
name="first_name"
value="{{ old('first_name') ?? $currentCustomer->first_name }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.first_name') }}&quot;">
<span class="control-error" v-if="errors.has('first_name')" v-text="errors.first('first_name')"></span>
<span
class="control-error"
v-text="errors.first('first_name')"
v-if="errors.has('first_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.first_name.after') !!}
@ -44,9 +63,19 @@
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name" class="mandatory">{{ __('shop::app.customer.account.address.create.last_name') }}</label>
<input type="text" class="control" name="last_name" value="{{ old('last_name') ?? $currentCustomer->last_name }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.last_name') }}&quot;">
<input
class="control"
type="text"
name="last_name"
value="{{ old('last_name') ?? $currentCustomer->last_name }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.last_name') }}&quot;">
<span class="control-error" v-if="errors.has('last_name')" v-text="errors.first('last_name')"></span>
<span
class="control-error"
v-text="errors.first('last_name')"
v-if="errors.has('last_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.last_name.after') !!}
@ -56,9 +85,19 @@
<span class="help-note">{{ __('shop::app.customer.account.address.create.vat_help_note') }}</span>
</label>
<input type="text" class="control" name="vat_id" value="{{ old('vat_id') }}" v-validate="" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.vat_id') }}&quot;">
<input
class="control"
type="text"
name="vat_id"
value="{{ old('vat_id') }}"
v-validate=""
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.vat_id') }}&quot;">
<span class="control-error" v-if="errors.has('vat_id')" v-text="errors.first('vat_id')"></span>
<span
class="control-error"
v-text="errors.first('vat_id')"
v-if="errors.has('vat_id')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.vat_id.after') !!}
@ -70,15 +109,30 @@
<div class="control-group" :class="[errors.has('address1[]') ? 'has-error' : '']">
<label for="address_0" class="mandatory">{{ __('shop::app.customer.account.address.create.street-address') }}</label>
<input type="text" class="control" name="address1[]" id="address_0" value="{{ $addresses[0] ?: '' }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.street-address') }}&quot;">
<input
class="control"
id="address_0"
type="text"
name="address1[]"
value="{{ $addresses[0] ?: '' }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.street-address') }}&quot;">
<span class="control-error" v-text="'{{ $errors->first('address1.*') }}'"></span>
<span
class="control-error"
v-text="'{{ $errors->first('address1.*') }}'">
</span>
</div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1)
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
<div class="control-group" style="margin-top: -25px;">
<input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}" value="{{ $addresses[$i] ?? '' }}">
<input
class="control"
id="address_{{ $i }}"
type="text"
name="address1[{{ $i }}]"
value="{{ $addresses[$i] ?? '' }}">
</div>
@endfor
@endif
@ -92,19 +146,39 @@
<div class="control-group" :class="[errors.has('city') ? 'has-error' : '']">
<label for="city" class="mandatory">{{ __('shop::app.customer.account.address.create.city') }}</label>
<input type="text" class="control" name="city" value="{{ old('city') }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.city') }}&quot;">
<input
type="text"
class="control"
name="city"
value="{{ old('city') }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.city') }}&quot;">
<span class="control-error" v-if="errors.has('city')" v-text="errors.first('city')"></span>
<span
class="control-error"
v-text="errors.first('city')"
v-if="errors.has('city')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.city.after') !!}
<div class="control-group" :class="[errors.has('postcode') ? 'has-error' : '']">
<label for="postcode" class="mandatory">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<label for="postcode" class="{{ core()->isPostCodeRequired() ? 'mandatory' : '' }}">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<input type="text" class="control" name="postcode" value="{{ old('postcode') }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.postcode') }}&quot;">
<input
class="control"
type="text"
name="postcode"
value="{{ old('postcode') }}"
v-validate="'{{ core()->isPostCodeRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.postcode') }}&quot;">
<span class="control-error" v-if="errors.has('postcode')" v-text="errors.first('postcode')"></span>
<span
class="control-error"
v-text="errors.first('postcode')"
v-if="errors.has('postcode')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.postcode.after') !!}
@ -112,15 +186,30 @@
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone" class="mandatory">{{ __('shop::app.customer.account.address.create.phone') }}</label>
<input type="text" class="control" name="phone" value="{{ old('phone') }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.phone') }}&quot;">
<input
class="control"
type="text"
name="phone"
value="{{ old('phone') }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.phone') }}&quot;">
<span class="control-error" v-if="errors.has('phone')" v-text="errors.first('phone')"></span>
<span
class="control-error"
v-text="errors.first('phone')"
v-if="errors.has('phone')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.create_form_controls.after') !!}
<div class="control-group d-flex">
<input type="checkbox" id="default_address" class="w-auto" name="default_address" {{ old('default_address') ? 'checked' : '' }}>
<input
class="w-auto"
id="default_address"
type="checkbox"
name="default_address"
{{ old('default_address') ? 'checked' : '' }}>
<label class="checkbox-view" for="default_address"></label>

View File

@ -24,9 +24,18 @@
<div class="control-group" :class="[errors.has('company_name') ? 'has-error' : '']">
<label for="company_name">{{ __('shop::app.customer.account.address.edit.company_name') }}</label>
<input type="text" class="control" name="company_name" value="{{ old('company_name') ?? $address->company_name }}" data-vv-as="&quot;{{ __('shop::app.customer.account.address.edit.company_name') }}&quot;">
<input
class="control"
type="text"
name="company_name"
value="{{ old('company_name') ?? $address->company_name }}"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.edit.company_name') }}&quot;">
<span class="control-error" v-if="errors.has('company_name')" v-text="errors.first('company_name')"></span>
<span
class="control-error"
v-text="errors.first('company_name')"
v-if="errors.has('company_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.company_name.after') !!}
@ -34,9 +43,19 @@
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name" class="mandatory">{{ __('shop::app.customer.account.address.create.first_name') }}</label>
<input type="text" class="control" name="first_name" value="{{ old('first_name') ?? $address->first_name }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.first_name') }}&quot;">
<input
type="text"
class="control"
name="first_name"
value="{{ old('first_name') ?? $address->first_name }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.first_name') }}&quot;">
<span class="control-error" v-if="errors.has('first_name')" v-text="errors.first('first_name')"></span>
<span
class="control-error"
v-text="errors.first('first_name')"
v-if="errors.has('first_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.first_name.after') !!}
@ -44,9 +63,19 @@
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name" class="mandatory">{{ __('shop::app.customer.account.address.create.last_name') }}</label>
<input type="text" class="control" name="last_name" value="{{ old('last_name') ?? $address->last_name }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.last_name') }}&quot;">
<input
class="control"
type="text"
name="last_name"
value="{{ old('last_name') ?? $address->last_name }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.last_name') }}&quot;">
<span class="control-error" v-if="errors.has('last_name')" v-text="errors.first('last_name')"></span>
<span
class="control-error"
v-text="errors.first('last_name')"
v-if="errors.has('last_name')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.last_name.after') !!}
@ -56,9 +85,19 @@
<span class="help-note">{{ __('shop::app.customer.account.address.create.vat_help_note') }}</span>
</label>
<input type="text" class="control" name="vat_id" value="{{ old('vat_id') ?? $address->vat_id }}" v-validate="" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.vat_id') }}&quot;">
<input
class="control"
type="text"
name="vat_id"
value="{{ old('vat_id') ?? $address->vat_id }}"
v-validate=""
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.vat_id') }}&quot;">
<span class="control-error" v-if="errors.has('vat_id')" v-text="errors.first('vat_id')"></span>
<span
class="control-error"
v-text="errors.first('vat_id')"
v-if="errors.has('vat_id')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.vat_id.after') !!}
@ -70,15 +109,30 @@
<div class="control-group" :class="[errors.has('address1[]') ? 'has-error' : '']">
<label for="address_0" class="mandatory">{{ __('shop::app.customer.account.address.edit.street-address') }}</label>
<input type="text" class="control" name="address1[]" value="{{ isset($addresses[0]) ? $addresses[0] : '' }}" id="address_0" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.street-address') }}&quot;">
<input
class="control"
id="address_0"
type="text"
name="address1[]"
value="{{ isset($addresses[0]) ? $addresses[0] : '' }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.street-address') }}&quot;">
<span class="control-error" v-text="'{{ $errors->first('address1.*') }}'"></span>
<span
class="control-error"
v-text="'{{ $errors->first('address1.*') }}'">
</span>
</div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1)
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
<div class="control-group" style="margin-top: -25px;">
<input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}" value="{{ $addresses[$i] ?? '' }}">
<input
class="control"
type="text"
name="address1[{{ $i }}]"
id="address_{{ $i }}"
value="{{ $addresses[$i] ?? '' }}">
</div>
@endfor
@endif
@ -92,19 +146,39 @@
<div class="control-group" :class="[errors.has('city') ? 'has-error' : '']">
<label for="city" class="mandatory">{{ __('shop::app.customer.account.address.create.city') }}</label>
<input type="text" class="control" name="city" value="{{ old('city') ?? $address->city }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.city') }}&quot;">
<input
class="control"
type="text"
name="city"
value="{{ old('city') ?? $address->city }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.city') }}&quot;">
<span class="control-error" v-if="errors.has('city')" v-text="errors.first('city')"></span>
<span
class="control-error"
v-text="errors.first('city')"
v-if="errors.has('city')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.create.after') !!}
<div class="control-group" :class="[errors.has('postcode') ? 'has-error' : '']">
<label for="postcode" class="mandatory">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<label for="postcode" class="{{ core()->isPostCodeRequired() ? 'mandatory' : '' }}">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<input type="text" class="control" name="postcode" value="{{ old('postcode') ?? $address->postcode }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.postcode') }}&quot;">
<input
class="control"
type="text"
name="postcode"
value="{{ old('postcode') ?? $address->postcode }}"
v-validate="'{{ core()->isPostCodeRequired() ? 'required' : '' }}'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.postcode') }}&quot;">
<span class="control-error" v-if="errors.has('postcode')" v-text="errors.first('postcode')"></span>
<span
class="control-error"
v-text="errors.first('postcode')"
v-if="errors.has('postcode')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.postcode.after') !!}
@ -112,15 +186,30 @@
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone" class="mandatory">{{ __('shop::app.customer.account.address.create.phone') }}</label>
<input type="text" class="control" name="phone" value="{{ old('phone') ?? $address->phone }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.phone') }}&quot;">
<input
class="control"
type="text"
name="phone"
value="{{ old('phone') ?? $address->phone }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.phone') }}&quot;">
<span class="control-error" v-if="errors.has('phone')" v-text="errors.first('phone')"></span>
<span
class="control-error"
v-text="errors.first('phone')"
v-if="errors.has('phone')">
</span>
</div>
{!! view_render_event('bagisto.shop.customers.account.address.edit_form_controls.after', ['address' => $address]) !!}
<div class="control-group d-flex">
<input type="checkbox" id="default_address" class="w-auto" name="default_address" {{ $address->default_address ? 'checked' : '' }} >
<input
class="w-auto"
id="default_address"
type="checkbox"
name="default_address"
{{ $address->default_address ? 'checked' : '' }}>
<label class="checkbox-view" for="default_address"></label>

View File

@ -39,13 +39,12 @@
<h5 class="card-title fw6">{{ $address->first_name }} {{ $address->last_name }}</h5>
<ul type="none">
{{-- <li>{{ $address->company_name }}</li> --}}
<li>{{ $address->address1 }},</li>
<li>{{ $address->city }},</li>
<li>{{ $address->state }},</li>
<li>{{ $address->address1 }}</li>
<li>{{ $address->city }}</li>
<li>{{ $address->state }}</li>
<li>{{ core()->country_name($address->country) }} {{ $address->postcode }}</li>
<li>
{{ __('shop::app.customer.account.address.index.contact') }} : {{$address->phone }}
{{ __('shop::app.customer.account.address.index.contact') }} : {{ $address->phone }}
</li>
</ul>
@ -59,6 +58,7 @@
<form id="deleteAddressForm" action="{{ route('address.delete', $address->id) }}" method="post">
@method('delete')
@csrf
</form>
</div>

View File

@ -4,23 +4,26 @@ namespace Tests\Functional\Checkout\Order;
use Faker\Factory;
use FunctionalTester;
use Webkul\Sales\Models\Order;
use Webkul\Core\Models\Channel;
use Webkul\Customer\Models\Customer;
use Webkul\Sales\Models\OrderAddress;
use Webkul\Sales\Models\OrderPayment;
use Webkul\Checkout\Models\CartAddress;
use Webkul\Checkout\Models\CartPayment;
use Webkul\Core\Models\Channel;
use Webkul\Customer\Models\Customer;
use Webkul\Sales\Models\Order;
use Webkul\Sales\Models\OrderAddress;
use Webkul\Sales\Models\OrderPayment;
/**
* Class OrderCest
* OrderCest class.
*
* @package Tests\Functional\Checkout\Cart
*/
class OrderCest
{
/**
* @param \FunctionalTester $I
* Test checkout as customer.
*
* @param \FunctionalTester $I
* @return void
*/
public function testCheckoutAsCustomer(FunctionalTester $I)
{
@ -28,7 +31,7 @@ class OrderCest
$faker = Factory::create();
$addressData = [
$addressData = $this->cleanAllFields([
'city' => $faker->city,
'company_name' => $faker->company,
'country' => $faker->countryCode,
@ -38,16 +41,20 @@ class OrderCest
'phone' => $faker->phoneNumber,
'postcode' => $faker->postcode,
'state' => $faker->state,
];
]);
$mocks = $I->prepareCart([
'customer' => $customer,
]);
// assert that checkout can be reached and generate csrf token
/**
* Assert that checkout can be reached and generate csrf token.
*/
$I->amOnRoute('shop.checkout.onepage.index');
// simulate the entering of the address(es)
/**
* Simulate the entering of the address(es).
*/
$I->sendAjaxPostRequest(route('shop.checkout.save-address'), [
'_token' => csrf_token(),
'billing' => array_merge($addressData, [
@ -98,7 +105,9 @@ class OrderCest
'cart_id' => $mocks['cart']->id,
]);
// simulate click on the 'place order' button at the last step
/**
* Simulate click on the 'place order' button at the last step.
*/
$I->sendAjaxPostRequest(
route('shop.checkout.save-order'),
['_token' => csrf_token()]
@ -143,4 +152,28 @@ class OrderCest
'order_id' => $order->id,
]);
}
/**
* Clean all fields.
*
* @param array $fields
* @return array
*/
private function cleanAllFields(array $fields)
{
return collect($fields)->map(function ($field, $key) {
return $this->cleanField($field);
})->toArray();
}
/**
* Clean fields.
*
* @param string $field
* @return string
*/
private function cleanField($field)
{
return preg_replace('/[^A-Za-z0-9 ]/', '', $field);
}
}