1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

(feat) manage orders in admin dashbaord

This commit is contained in:
Du Peng 2022-09-13 19:47:19 +02:00
parent f130ba46c1
commit 32b19ed4f7
5 changed files with 7 additions and 5 deletions

View File

@ -50,7 +50,7 @@ export const OrderItem: React.FC<OrderItemProps> = ({ order, currentUser }) => {
<p className="date">{FormatLib.date(order.created_at)}</p>
<div className='price'>
<span>{t('app.shared.store.order_item.total')}</span>
<p>{FormatLib.price(order?.paid_total)}</p>
<p>{FormatLib.price(order.state === 'cart' ? order.total : order.paid_total)}</p>
</div>
<FabButton onClick={() => showOrder(order)} icon={<i className="fas fa-eye" />} className="is-black" />
</div>

View File

@ -147,7 +147,7 @@ export const ShowOrder: React.FC<ShowOrderProps> = ({ orderId, currentUser, onEr
{isPrivileged() && order.user &&
<div className='group'>
<span>{t('app.shared.store.show_order.client')}</span>
<p>order.user.name</p>
<p>{order.user.name}</p>
</div>
}
<div className='group'>

View File

@ -9,7 +9,7 @@ Application.Controllers.controller('AdminShowOrdersController', ['$rootScope', '
/* PRIVATE SCOPE */
/* PUBLIC SCOPE */
$scope.orderToken = $transition$.params().token;
$scope.orderId = $transition$.params().id;
/**
* Callback triggered in case of error

View File

@ -15,5 +15,5 @@
<span translate>{{ 'app.admin.store.back_to_list' }}</span>
</a>
</div>
<show-order current-user="currentUser" order-ref="orderRef" on-error="onError" on-success="onSuccess" />
</section>
<show-order current-user="currentUser" order-id="orderId" on-error="onError" on-success="onSuccess" />
</section>

View File

@ -15,6 +15,8 @@ class Orders::OrderService
orders = orders.where(statistic_profile_id: statistic_profile_id)
elsif current_user.member?
orders = orders.where(statistic_profile_id: current_user.statistic_profile.id)
else
orders = orders.where.not(statistic_profile_id: nil)
end
orders = orders.where.not(state: 'cart') if current_user.member?
orders = orders.order(created_at: filters[:page].present? ? filters[:sort] : 'DESC')