diff --git a/app/assets/stylesheets/components/_card.scss b/app/assets/stylesheets/components/_card.scss new file mode 100644 index 0000000..0168d41 --- /dev/null +++ b/app/assets/stylesheets/components/_card.scss @@ -0,0 +1,39 @@ +.card { + .card-disabled-message { + display: none; + } + &.card-disabled { + position: relative; + .card-disabled-message { + background-color: theme-color('danger'); + border-radius: $border-radius; + color: $white; + display: block; + font-weight: bold; + font-size: .7rem; + left: 50%; + opacity: .7; + padding: .3rem; + padding-left: 1rem; + padding-right: 1rem; + position: absolute; + text-align: center; + text-transform: uppercase; + bottom: -.5rem; + transform: translate(-50%, -50%); + z-index: 11; + } + &:after { + $strip-color-1: transparentize(theme-color('danger'), .7); + $strip-color-2: transparentize(theme-color('danger'), .8); + background-image: repeating-linear-gradient(45deg, $strip-color-1, $strip-color-1 30px, $strip-color-2 30px, $strip-color-2 60px); + content: ' '; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; + z-index: 10; + } + } +} diff --git a/app/views/pages/account/account_address.liquid b/app/views/pages/account/account_address.liquid index 6709470..d5731ef 100755 --- a/app/views/pages/account/account_address.liquid +++ b/app/views/pages/account/account_address.liquid @@ -17,18 +17,29 @@ slug: addresses

{{'account_address_lists' | translate }}

+ {% if store.customer.permission.address.create == true %}
+ {% endif %}
{% with_scope address_type: "address"%}
- {% for address in store.addresses%} -
-
+ {% for address in store.addresses %} + {% assign address_css = "" %} + {% if address.enabled != true %} + {% assign address_css = "card-disabled" %} + {% endif %} +
+
+ {% if address.enabled != true %} +
+ {{ 'account_address_disabled' | translate }} +
+ {% endif %}
@@ -39,21 +50,27 @@ slug: addresses {{address.name}}
-
-
- - -
-
- - - -
-
+ {% if address.enabled %} +
+ {% if address.access.update %} +
+ + +
+ {% endif %} + {% if address.access.delete %} +
+ + + +
+ {% endif %} +
+ {% endif %}
@@ -69,6 +86,9 @@ slug: addresses
{{address.country.name}}
+
+ {{address.phone}} +
diff --git a/app/views/pages/account/account_address_form.liquid b/app/views/pages/account/account_address_form.liquid index e80ad0c..3631b60 100755 --- a/app/views/pages/account/account_address_form.liquid +++ b/app/views/pages/account/account_address_form.liquid @@ -7,13 +7,26 @@ seo_title: Update my address | Shopinvader demo {% extends 'layouts/account '%} {% block 'body/content/tabcontent' %} -{% assign form_action = '/invader/addresses/create' %} + +{% assign disabled = true %} {% if params.item_id %} - {% with_scope id: params.item_id %} + {% assign item_id = params.item_id | round %} + {% with_scope id: item_id %} {% assign address = store.addresses.first %} - - {% assign form_action = '/invader/addresses/' | append: address.id | append: "/update" %} + {% if address.enabled and address.access.update %} + {% assign form_action = '/invader/addresses/' | append: address.id | append: "/update" %} + {% assign disabled = false %} + {% else %} + {% assign error_msg = 'account_address_no_update' | translate %} + {% endif %} {% endwith_scope%} +{% else %} + {% if store.customer.permission.address.create == true%} + {% assign form_action = '/invader/addresses/create' %} + {% assign disabled = false %} + {% else %} + {% assign error_msg = 'account_address_no_create' | translate %} + {% endif %} {% endif %}
@@ -22,19 +35,49 @@ seo_title: Update my address | Shopinvader demo {{'account_address_update' | translate }}
-
- - - {% include 'address_form' with address, with_require: true %} + {% if disabled == true %}
-
- {{'account_address_cancel' | translate}} +
+
+ + {{error_msg}} +
-
- +
+ {% if address %} + {% include 'address_form' with + address, + disabled: true + %} + {% endif %} + - + {% else %} +
+ + + {% include 'address_form' with + address, + with_require: true, + disabled: false + %} + +
+ {% endif %}
diff --git a/app/views/pages/account/account_profile.liquid b/app/views/pages/account/account_profile.liquid index a8e3000..6c595f1 100755 --- a/app/views/pages/account/account_profile.liquid +++ b/app/views/pages/account/account_profile.liquid @@ -11,20 +11,43 @@ seo_title: My account profile | Shopinvader demo
{% with_scope address_type: "profile"%} {% assign profile = store.addresses.first %} + {% assign disabled = true %} + {% if profile.access.update %} + {% assign disabled = false %} + {% endif %}

{{'account_profil_title' | translate}}

+ {% if disabled == true %} +
+
+
+ + {{ 'account_address_no_update' | translate }} +
+
+
+ {% include 'address_form' with + address: profile, + disabled: true + %} + {% else %}
- {% include 'address_form' with address: profile %} -
- -
+ {% include 'address_form' with + address: profile + %} + {% if profile.access.update %} +
+ +
+ {% endif %}
+ {% endif %}
{% endwith_scope%} diff --git a/app/views/pages/account/account_user_disabled.liquid b/app/views/pages/account/account_user_disabled.liquid new file mode 100644 index 0000000..741d488 --- /dev/null +++ b/app/views/pages/account/account_user_disabled.liquid @@ -0,0 +1,26 @@ +--- +handle: account_user_disabled +title: Account User disabled +listed: false +position: 200 +published: true +seo_title: Your account is not enable yet | Shopinvader demo +slug: addresses-user-disabled +--- +{% extends 'layouts/account '%} + +{% block 'body/content/tabcontent' %} +
+

+ {{ 'account_user_disabled' | translate }} +

+
+ + + +
+
+{% endblock %} \ No newline at end of file diff --git a/app/views/pages/layouts/base.liquid b/app/views/pages/layouts/base.liquid index f24c4da..8077c23 100644 --- a/app/views/pages/layouts/base.liquid +++ b/app/views/pages/layouts/base.liquid @@ -3,6 +3,14 @@ handle: base title: Base layout is_layout: false --- +{% if current_customer and page.handle != 'account_user_disabled' %} + {% if store.customer.enabled != true %} + {% action 'redirect to account_user_disabled' %} + redirectTo('account_user_disabled'); + {% endaction %} + {% endif %} +{% endif %} + {% if locale != default_locale %} {% assign url_base ="/" | append: locale %} {% endif%} diff --git a/app/views/sections/cart_address.liquid b/app/views/sections/cart_address.liquid index acbd3a9..77b3a69 100644 --- a/app/views/sections/cart_address.liquid +++ b/app/views/sections/cart_address.liquid @@ -20,39 +20,76 @@ blocks: []
{% if params.item_id %} - {% assign form_action = '/invader/addresses/create' %} - {% if params.item_id and params.item_id != ''%} - {% with_scope id: params.item_id %} + {% assign disabled = true %} + {% assign item_id = params.item_id | round %} + + {% if item_id != null %} + {% with_scope id: item_id %} {% assign address = store.addresses.first %} - {% assign form_action = '/invader/addresses/' | append: address.id | append: "/update" %} + {% if address.enabled and address.access.update %} + {% assign form_action = '/invader/addresses/' | append: address.id | append: "/update" %} + {% assign disabled = false %} + {% else %} + {% assign error_msg = 'account_address_no_update' | translate %} + {% endif %} {% endwith_scope%} + {% else %} + {% if store.customer.permission.address.create %} + {% assign form_action = '/invader/addresses/create' %} + {% assign disabled = false %} + {% else %} + {% assign error_msg = 'account_address_no_create' | translate %} + {% endif %} {% endif %} -
- - + {% if disabled %}
- -
-
- {% include "address_form" with address, with_require: true %} + {% else %} + + + + -
-
-
- - {{'btn_back' | translate }} - +
+
+ {% include "address_form" with + address, + with_require: true + disabled: true + %} +
-
- +
+ +
+ +
-
- + + {% endif %} {% else %} {% assign selected_address = store.cart.shipping.address %} {% if selected_address == null %} @@ -64,12 +101,13 @@ blocks: [] {{'cart_shipping_address' | translate }}
- + {% if store.customer.permission.address.create %} + + {% endif %}
@@ -77,25 +115,43 @@ blocks: [] {%for address in store.addresses %} - -
@@ -140,73 +196,60 @@ blocks: [] {%for address in store.addresses %} - - -