Skip to content
This repository has been archived by the owner on Apr 22, 2022. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
t13ka committed Apr 17, 2020
2 parents de8d2ec + c7b52d6 commit 96c7c48
Show file tree
Hide file tree
Showing 15 changed files with 237 additions and 136 deletions.
21 changes: 12 additions & 9 deletions client-app/src/libs/shopping-cart/components/cart-header/index.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<template>
<div class="d-flex justify-content-between align-items-start">
<h5 class="m-0 text-break">
{{ title }}
</h5>
<button v-if="cart.itemsCount != 0"
class="btn btn-link px-0 pt-0 text-nowrap"
@click="onClearCartClicked()">
{{ $t('shopping-cart.clear-cart') }}
</button>
<div class="d-flex flex-column">
<div class="d-flex justify-content-between align-items-start">
<h5 class="m-0 text-break">
{{ title }}
</h5>
<button v-if="cart.itemsCount != 0"
class="btn btn-link px-0 pt-0 text-nowrap"
@click="onClearCartClicked()">
{{ $t('shopping-cart.clear-cart') }}
</button>
</div>
<div>{{ $t('shopping-cart.items-qty-message', [cart.itemsQuantity]) }}</div>
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ShoppingCart } from 'core/api/api-clients';
name: "CartSummary"
})
export default class CartSummary extends Vue {

@Prop()
cart!: ShoppingCart;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div class="d-flex flex-column">
<div>You have {{ cart.itemsCount }} items in your order</div>
<div class="mt-1">
<div class="d-flex">
{{ $t('shopping-cart.subtotal') }} <span class="ml-auto font-weight-bold">{{ cart.subTotal.formattedAmount }}</span>
Expand Down
10 changes: 8 additions & 2 deletions client-app/src/libs/shopping-cart/store/cart/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AddCartItem, ChangeCartItemQty } from 'core/api/api-clients';
import { storeName, locale } from 'core/constants';
import { cartClient} from 'core/services/api-clients.service';
import { RootState } from 'store/types';
import { FETCH_CART, FETCH_CART_ITEMS_COUNT, ADD_ITEM_TO_CART, DELETE_ITEM_FROM_CART, CLEAR_CART, CHANGE_ITEM_QUANTITY, SHOW_CART_SIDEBAR, HIDE_CART_SIDEBAR } from './definitions';
import { FETCH_CART, FETCH_CART_ITEMS_COUNT, ADD_ITEM_TO_CART, DELETE_ITEM_FROM_CART, CLEAR_CART, CHANGE_ITEM_QUANTITY, SHOW_CART_SIDEBAR, HIDE_CART_SIDEBAR, CHECKOUT } from './definitions';
import { SET_CART, SET_CART_ITEMS_COUNT, SET_SIDEBAR_VISIBLE } from "./mutations"
import { CartState } from "./types";

Expand Down Expand Up @@ -38,12 +38,18 @@ export const actions: ActionTree<CartState, RootState> = {
await context.dispatch(FETCH_CART_ITEMS_COUNT);
await context.dispatch(FETCH_CART);
},
async [CLEAR_CART](context, payload: string) {
async [CLEAR_CART](context) {
context.commit(FETCH_CART);
await cartClient.clearCart(storeName, locale);
await context.dispatch(FETCH_CART_ITEMS_COUNT);
await context.dispatch(FETCH_CART);
},
async [CHECKOUT](context) {
context.commit(FETCH_CART);
await cartClient.createOrder(null, storeName, locale);
await context.dispatch(FETCH_CART_ITEMS_COUNT);
await context.dispatch(FETCH_CART);
},
[SHOW_CART_SIDEBAR](context){
context.commit(SET_SIDEBAR_VISIBLE, true);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export const CLEAR_CART = "clearCart";
export const CHANGE_ITEM_QUANTITY = "changeCartItemQuantity";
export const SHOW_CART_SIDEBAR = "showCartSidebar";
export const HIDE_CART_SIDEBAR = "hideCartSidebar";
export const CHECKOUT = "checkout";
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export default class EditUserModal extends Vue {
@Prop()
user!: User;

@Prop()
isLoading!: boolean;

@Watch("user")
onPropertyChanged(newUser: User) {
const newUserCopy = new User();
Expand Down
116 changes: 61 additions & 55 deletions client-app/src/libs/user/components/edit-user-modal/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,70 @@
<div slot="modal-title">
{{ $t("account.users.edit-user-title") }}
</div>
<b-form v-if="userInfo"
id="edit-user-form"
novalidate
@submit.prevent="submitForm">
<b-form-group :label="$t('account.users.add-user.email-label')" label-for="email">
<b-form-input
id="email"
v-model="$v.userInfo.email.$model"
type="email"
:class="{ 'is-invalid': $v.userInfo.email.$error }"
:placeholder="$t('account.users.add-user.email-placeholder')"></b-form-input>
<b-form-invalid-feedback
v-if="!$v.userInfo.email.email">
{{ $t("account.users.add-user.email-not-valid") }}
</b-form-invalid-feedback>
</b-form-group>
<b-overlay
:show="isLoading"
rounded="sm"
:variant="'white'"
:opacity="0.69">
<b-form v-if="userInfo"
id="edit-user-form"
novalidate
@submit.prevent="submitForm">
<b-form-group :label="$t('account.users.add-user.email-label')" label-for="email">
<b-form-input
id="email"
v-model="$v.userInfo.email.$model"
type="email"
:class="{ 'is-invalid': $v.userInfo.email.$error }"
:placeholder="$t('account.users.add-user.email-placeholder')"></b-form-input>
<b-form-invalid-feedback
v-if="!$v.userInfo.email.email">
{{ $t("account.users.add-user.email-not-valid") }}
</b-form-invalid-feedback>
</b-form-group>

<b-form-group :label=" $t('account.users.add-user.first-name-label')" label-for="firstName">
<b-form-input
id="firstName"
v-model="$v.userInfo.firstName.$model"
:class="{ 'is-invalid': $v.userInfo.firstName.$error }"
type="text"
:placeholder="$t('account.users.add-user.first-name-placeholder')"
@blur="$v.userInfo.firstName.$touch()"></b-form-input>
<b-form-invalid-feedback v-if="!$v.userInfo.firstName.required">
{{ $t("account.users.add-user.first-name-required") }}
</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label=" $t('account.users.add-user.first-name-label')" label-for="firstName">
<b-form-input
id="firstName"
v-model="$v.userInfo.firstName.$model"
:class="{ 'is-invalid': $v.userInfo.firstName.$error }"
type="text"
:placeholder="$t('account.users.add-user.first-name-placeholder')"
@blur="$v.userInfo.firstName.$touch()"></b-form-input>
<b-form-invalid-feedback v-if="!$v.userInfo.firstName.required">
{{ $t("account.users.add-user.first-name-required") }}
</b-form-invalid-feedback>
</b-form-group>

<b-form-group :label=" $t('account.users.add-user.last-name-label')" label-for="lastName">
<b-form-input
id="lastName"
v-model="$v.userInfo.lastName.$model"
:class="{ 'is-invalid': $v.userInfo.lastName.$error }"
type="text"
:placeholder="$t('account.users.add-user.last-name-placeholder')"
@blur="$v.userInfo.lastName.$touch()"></b-form-input>
<b-form-invalid-feedback v-if="!$v.userInfo.lastName.required">
{{ $t("account.users.add-user.last-name-required") }}
</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label=" $t('account.users.add-user.last-name-label')" label-for="lastName">
<b-form-input
id="lastName"
v-model="$v.userInfo.lastName.$model"
:class="{ 'is-invalid': $v.userInfo.lastName.$error }"
type="text"
:placeholder="$t('account.users.add-user.last-name-placeholder')"
@blur="$v.userInfo.lastName.$touch()"></b-form-input>
<b-form-invalid-feedback v-if="!$v.userInfo.lastName.required">
{{ $t("account.users.add-user.last-name-required") }}
</b-form-invalid-feedback>
</b-form-group>

<b-form-group :label="$t('account.users.add-user.role-label')" label-for="role">
<b-form-select id="role"
v-model="userInfo.role.name"
plain>
<b-form-select-option
value="Store administrator">
{{ $t("account.users.add-user.account-admin") }}
</b-form-select-option>
<b-form-select-option
value="Store manager">
{{ $t("account.users.add-user.business-user") }}
</b-form-select-option>
</b-form-select>
</b-form-group>
</b-form>
<b-form-group :label="$t('account.users.add-user.role-label')" label-for="role">
<b-form-select id="role"
v-model="userInfo.role.name"
plain>
<b-form-select-option
value="Store administrator">
{{ $t("account.users.add-user.account-admin") }}
</b-form-select-option>
<b-form-select-option
value="Store manager">
{{ $t("account.users.add-user.business-user") }}
</b-form-select-option>
</b-form-select>
</b-form-group>
</b-form>
</b-overlay>
<template v-slot:modal-footer>
<b-button
variant="outline-primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Vue from "vue";
import Component from "vue-class-component";
import { Route, RawLocation } from 'vue-router';
import { namespace } from "vuex-class";
import { faTrashAlt } from '@fortawesome/free-regular-svg-icons';
import i18n from "@i18n";
import { BvTableFieldArray } from "bootstrap-vue";
import AddDraftModal from "libs/order-draft/components/add-draft-modal/index.vue";
Expand Down Expand Up @@ -55,6 +56,8 @@ export default class AccountDrafts extends Vue {

showDraftDetailsSidebar = false;

deleteIcon = faTrashAlt;

queryBuilder = new QueryBuilder(CartSearchCriteria, CartSearchQuery);

mounted() {
Expand Down
10 changes: 7 additions & 3 deletions client-app/src/pages/account/views/account-drafts/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@
no-local-sorting
@row-clicked="showDraftDetails">
<template v-slot:cell(actions)="row">
<u
class="btn d-inline p-0"
@click.stop="confirmDeleteDraft(row.item)">{{ $t("account.drafts.delete-draft") }}</u>
<font-awesome-layers
v-b-tooltip.hover
:title="$t('account.drafts.delete-draft-tooltip')"
class="btn"
@click.stop="confirmDeleteDraft(row.item)">
<font-awesome-icon :icon="deleteIcon" size="lg"></font-awesome-icon>
</font-awesome-layers>
</template>
</b-table>
<div class="d-flex justify-content-between">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,8 @@ export default class AccountUsers extends Vue {
}
}

isCurrentUser(user: User) {
return this.profile.id == user.id;
}

}
27 changes: 18 additions & 9 deletions client-app/src/pages/account/views/account-users/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template>
<div class="mt-3">
<add-user-modal @userAdded="userAdded($event)"></add-user-modal>
<edit-user-modal :user="selectedUser" @userChanged="userChanged($event)"></edit-user-modal>
<edit-user-modal :user="selectedUser"
:is-loading="isLoading"
@userChanged="userChanged($event)"></edit-user-modal>
<div class="row flex-sm-row flex-column justify-content-between">
<users-filter
class="col col-sm-6 col-md-5 col-lg-3"
Expand Down Expand Up @@ -35,27 +37,34 @@
no-local-sorting
@sort-changed="sortChanged">
<template v-slot:cell(actions)="row">
<div class="d-flex justify-content-md-around">
<font-awesome-layers
v-if="$can($permissions.CanEditUsers)"
class="btn"
@click="openEditUserModal(row.item)">
<div class="d-flex">
<font-awesome-layers v-if="$can($permissions.CanEditUsers)"
v-b-tooltip.hover
:title="$t('account.users.edit-user-tooltip')"
class="btn"
@click="openEditUserModal(row.item)">
<font-awesome-icon :icon="editIcon" size="lg"></font-awesome-icon>
</font-awesome-layers>
<font-awesome-layers
v-if="$can($permissions.CanDeleteUsers)"
v-if="$can($permissions.CanDeleteUsers) && !isCurrentUser(row.item)"
v-b-tooltip.hover
:title="$t('account.users.delete-user-tooltip')"
class="btn"
@click="confirmDeleteUser(row.item)">
<font-awesome-icon :icon="deleteIcon" size="lg"></font-awesome-icon>
</font-awesome-layers>
<font-awesome-layers
v-if="!row.item.isLockedOut"
v-if="!row.item.isLockedOut && !isCurrentUser(row.item)"
v-b-tooltip.hover
:title="$t('account.users.suspend-user-tooltip')"
class="btn"
@click="changeUserSuspensionStatus(row.item, true)">
<font-awesome-icon :icon="suspendIcon" size="lg"></font-awesome-icon>
</font-awesome-layers>
<font-awesome-layers
v-if="row.item.isLockedOut"
v-if="row.item.isLockedOut && !isCurrentUser(row.item)"
v-b-tooltip.hover
:title="$t('account.users.unsuspend-user-tooltip')"
class="btn"
@click="changeUserSuspensionStatus(row.item, false)">
<font-awesome-icon :icon="unsuspendIcon" size="lg"></font-awesome-icon>
Expand Down
Loading

0 comments on commit 96c7c48

Please sign in to comment.