Skip to content

Commit f529744

Browse files
committed
update
1 parent b05f25c commit f529744

File tree

12 files changed

+258
-37
lines changed

12 files changed

+258
-37
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "enab",
3-
"version": "1.5.7",
3+
"version": "1.5.8",
44
"description": "Enab System",
55
"main": "./dist/main/index.js",
66
"scripts": {

src/renderer/assets/scss/style.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,4 +425,13 @@ input[type=checkbox]:checked+[data-chakra-component="CControlBox"]>*, input[type
425425
circle:nth-child(2) {
426426
color: #5cc9a7 !important;
427427
}
428+
}
429+
430+
[data-chakra-component="CTab"]{
431+
border-radius: $r-2 !important;
432+
}
433+
434+
[data-chakra-component="CTab"][aria-selected=true]{
435+
background: $tb-2 !important;
436+
border-radius: $r-2;
428437
}

src/renderer/components/Business.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ export default {
9898
if (this.$auth.user[this.name]) {
9999
this.$router.push("/" + this.name);
100100
this.selectBusiness({ name: this.name, title: this.title });
101+
102+
// Clear Storage
103+
window.localStorage.
101104
window.localStorage.clear();
102105
} else {
103106
this.sendCreateBusiness();
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<template>
2+
<div>
3+
<div class="row">
4+
<div class="col-xl-12 col-md-12 d-flex align-items-center">
5+
<c-heading as="h1" fontSize="4xl" ml="4" color="white">
6+
<i class="fas fa-user"></i>
7+
{{ customer.name }}
8+
</c-heading>
9+
10+
<c-button @click="$emit('no-customer')" px="6" height="100%" class="t-1 b-1 r-2 text-light me-auto" variant="ghost">
11+
رجوع
12+
</c-button>
13+
</div>
14+
<hr class="my-4" />
15+
<div class="col-xl-12 col-md-12 d-flex align-items-center">
16+
<div class="row w-100">
17+
<div class="col-4 t-1-h p-3 r-2 text-center">
18+
<h1 class="fs-1 text-light">300$</h1>
19+
<span class="fs-5">إجمالي الطلبات</span>
20+
</div>
21+
<div class="col-4 t-1-h p-3 r-2 text-center">
22+
<h1 class="fs-1 text-light">{{$n(customer.debt, 'currency')}}</h1>
23+
<span class="fs-5">الدين</span>
24+
</div>
25+
<div class="col-4 t-1-h p-3 r-2 text-center">
26+
<h1 class="fs-1 text-light">300$</h1>
27+
<span class="fs-5">الدين</span>
28+
</div>
29+
</div>
30+
</div>
31+
32+
<div class="col-xl-12 col-md-12 mt-3">
33+
<c-box class="w-100">
34+
<c-tabs variant="solid-rounded" is-fitted>
35+
<c-tab-list class="t-1 b-1 r-2 p-2">
36+
<c-tab>الطلبات</c-tab>
37+
<c-tab>النشاطات</c-tab>
38+
</c-tab-list>
39+
40+
<c-tab-panels class="mt-2 t-1 r-2 p-2">
41+
<c-tab-panel>
42+
<SupermarketCustomersOrders :orders="orders" />
43+
</c-tab-panel>
44+
<c-tab-panel>
45+
<p>two!</p>
46+
</c-tab-panel>
47+
</c-tab-panels>
48+
</c-tabs>
49+
</c-box>
50+
</div>
51+
</div>
52+
</div>
53+
</template>
54+
55+
<script>
56+
import { mapMutations, mapGetters, mapActions, mapState } from "vuex";
57+
58+
export default {
59+
props: ["id"],
60+
computed: {
61+
customer() {
62+
return this.$store.getters["supermarket/customers/customer"](this.id);
63+
},
64+
65+
customers() {
66+
return this.$store.getters["supermarket/customers/customers"];
67+
},
68+
69+
orders() {
70+
return this.$store.getters["supermarket/orders/ordersOfCustomer"](
71+
this.id
72+
);
73+
},
74+
},
75+
};
76+
</script>
77+
78+
<style lang="scss" scoped>
79+
</style>
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<template>
2+
<div>
3+
<!-- Show Products Modal -->
4+
<c-modal size="5xl" :is-open="show" :on-close="closeModal">
5+
<c-modal-content class="r-2" ref="content">
6+
<c-modal-header>تفاصيل الطلب / المنتجات</c-modal-header>
7+
<c-modal-close-button />
8+
<c-modal-body>
9+
<table class="table table-borderless text-right text-light">
10+
<thead>
11+
<tr>
12+
<th scope="col">#</th>
13+
<th scope="col">اسم المنتج</th>
14+
<th scope="col">فئة المنتج</th>
15+
<th scope="col">رقم الباركود</th>
16+
<th scope="col">السعر</th>
17+
<th scope="col">العدد</th>
18+
</tr>
19+
</thead>
20+
<tbody>
21+
<tr v-for="(s, i) in showProducts" :key="s.pivot.product_id">
22+
<th scope="row">{{ ++i }}</th>
23+
<td>{{ s.name }}</td>
24+
<td>{{ s.category.name }}</td>
25+
<td>{{ s.barcode }}</td>
26+
<td>{{ s.pivot.price }}</td>
27+
<td>{{ s.pivot.count }}</td>
28+
</tr>
29+
</tbody>
30+
</table>
31+
</c-modal-body>
32+
</c-modal-content>
33+
<c-modal-overlay />
34+
</c-modal>
35+
36+
<div class="table-responsive" v-if="orders.length > 0">
37+
<table class="table table-cards text-right">
38+
<thead>
39+
<tr class="text-light">
40+
<th scope="col">#</th>
41+
<th scope="col">رقم الطلب</th>
42+
<th scope="col">المبلغ الكلي</th>
43+
<th scope="col">أسم الموظف</th>
44+
</tr>
45+
</thead>
46+
<tbody>
47+
<tr v-for="(order, i) in paginatedData" :key="order.id" class="table-divider hover-translate-y-n3 pointer" @click="getProducts(order.products), show = true">
48+
<td class="align-middle" scope="row">{{ paginatedCounter + i + 1 }}</td>
49+
<td class="align-middle">{{ order.order_number }}</td>
50+
<td class="align-middle">{{ $n(order.total_price, 'currency') }}</td>
51+
<td class="align-middle">{{ order.user.name }}</td>
52+
</tr>
53+
</tbody>
54+
</table>
55+
<UtilitiesLoadMore @page="paginatedCounter = $event" @data="paginatedData = $event" :data="orders" perPage="10" />
56+
57+
</div>
58+
<div v-else>
59+
<c-alert class="bg-none b-1 r-2" variant="subtle" flexDirection="column" justifyContent="center" textAlign="center" height="200px">
60+
<c-alert-icon color="gray.250" name="warning" size="40px" :mr="0" />
61+
<c-alert-title :mt="4" :mb="1" fontSize="xl">
62+
لايوجد طلبات
63+
</c-alert-title>
64+
<c-alert-description maxWidth="sm">
65+
يمكن الشروع بإضافة الطلبات من خلال
66+
<nuxt-link to="/supermarket/new-order" class="fw-bold text-light"> نافذة الطلبات </nuxt-link>
67+
</c-alert-description>
68+
</c-alert>
69+
</div>
70+
</div>
71+
</template>
72+
73+
<script>
74+
import { mapMutations, mapGetters, mapActions, mapState } from "vuex";
75+
76+
export default {
77+
props: ["orders"],
78+
79+
data() {
80+
return {
81+
show: false,
82+
search: "",
83+
showProducts: [],
84+
85+
// Pagination
86+
paginatedData: [],
87+
paginatedCounter: 0,
88+
};
89+
},
90+
methods: {
91+
closeModal() {
92+
this.show = false;
93+
},
94+
getProducts: function (products) {
95+
console.log(products)
96+
this.showProducts = products;
97+
},
98+
},
99+
};
100+
</script>
101+
102+
<style lang="scss" scoped>
103+
</style>

src/renderer/components/supermarket/control/customers.vue

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<template>
22
<div class="mt-3">
3-
<div class="r-2 border-0 shadow-none">
3+
<div v-if="selectedCustomer > 0">
4+
<SupermarketCustomersCustomer @no-customer="selectedCustomer = -1" :id="selectedCustomer" />
5+
</div>
6+
<div :class="{ 'd-none': selectedCustomer > 0 }" class="r-2 border-0 shadow-none">
47
<div class="row">
58
<div class="col-xl-12 col-md-12 d-flex align-items-center">
69
<c-heading as="h1" fontSize="4xl" ml="4" color="white">الزبائن</c-heading>
@@ -81,6 +84,9 @@
8184
<td class="align-middle">{{ customer.phonenumber }}</td>
8285
<td class="align-middle">{{ customer.location }}</td>
8386
<td class="align-middle">
87+
<c-button v-if="customer.id !== 0" variant-color="gray" size="xs" @click="selectedCustomer = customer.id" variant="ghost">
88+
<i class="fas fa-eye"></i>
89+
</c-button>
8490
<c-button v-if="customer.id !== 0" variant-color="blue" size="xs" @click="thisData = getCustomer(customer.id), editState = true, show = true" variant="ghost">
8591
<i class="fas fa-pen"></i>
8692
</c-button>
@@ -118,10 +124,11 @@ export default {
118124
...mapGetters({
119125
getCustomer: "supermarket/customers/customer",
120126
}),
127+
121128
122-
customers(){
123-
return this.$store.getters['supermarket/customers/customers']
124-
}
129+
customers() {
130+
return this.$store.getters["supermarket/customers/customers"];
131+
},
125132
},
126133
data() {
127134
return {
@@ -130,13 +137,14 @@ export default {
130137
thisData: {},
131138
editState: "",
132139
loading: false,
140+
selectedCustomer: 0,
133141
134142
// Pagination
135143
paginatedData: [],
136-
paginatedCounter: 0
144+
paginatedCounter: 0,
137145
};
138146
},
139-
created(){
147+
created() {
140148
this.fetchCustomers();
141149
},
142150
methods: {
@@ -162,7 +170,6 @@ export default {
162170
...mapActions({
163171
removeCustomer: "supermarket/customers/removeCustomer",
164172
fetchCustomers: "supermarket/customers/fetchCustomers",
165-
166173
}),
167174
},
168175
watch: {

src/renderer/components/supermarket/control/orders.vue

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<template>
2-
<div class="mt-3">
2+
<div>
3+
<div v-if="selectedCustomer > 0">
4+
<SupermarketCustomersCustomer @no-customer="selectedCustomer = -1" :id="selectedCustomer" />
5+
</div>
6+
<div :class="{ 'd-none': selectedCustomer > 0 }" class="mt-3">
37
<!-- Show Products Modal -->
48
<c-modal size="5xl" :is-open="show" :on-close="closeModal">
59
<c-modal-content class="r-2" ref="content">
@@ -18,13 +22,13 @@
1822
</tr>
1923
</thead>
2024
<tbody>
21-
<tr v-for="(s, i) in showProducts" :key="s.product ? s.product.id : 'products.'+i">
25+
<tr v-for="(s, i) in showProducts" :key="s.pivot.product_id">
2226
<th scope="row">{{ ++i }}</th>
23-
<td>{{ s.product ? s.product.name : 'محذوف' }}</td>
24-
<td>{{ s.product ? categories.find(x => x.id == s.product.category_id).name : 'محذوف' }}</td>
25-
<td>{{ s.product ? s.product.barcode : '######' }}</td>
26-
<td>{{ s.price }}</td>
27-
<td>{{ s.inCount }}</td>
27+
<td>{{ s.name }}</td>
28+
<td>{{ s.category.name }}</td>
29+
<td>{{ s.barcode }}</td>
30+
<td>{{ s.pivot.price }}</td>
31+
<td>{{ s.pivot.count }}</td>
2832
</tr>
2933
</tbody>
3034
</table>
@@ -57,14 +61,27 @@
5761
<th scope="col">أسم الزبون</th>
5862
<th scope="col">رقم الطلب</th>
5963
<th scope="col">المبلغ الكلي</th>
64+
<th scope="col">اسم الموظف</th>
65+
<th scope="col">التحكم</th>
6066
</tr>
6167
</thead>
6268
<tbody>
63-
<tr v-for="(order, i) in paginatedData" :key="order.id" class="table-divider hover-translate-y-n3 pointer" @click="getProducts(order.products), show = true">
69+
<tr v-for="(order, i) in paginatedData" :key="order.id" class="table-divider hover-translate-y-n3">
6470
<td class="align-middle" scope="row">{{ paginatedCounter + i + 1 }}</td>
65-
<td class="align-middle">{{ (order.customer_id ? order.customer_id : 'لايوجد') }}</td>
71+
<td class="align-middle">
72+
<button v-if="order.customer" class="btn p-0" @click="selectedCustomer = order.customer.id">
73+
{{ order.customer.name }}
74+
</button>
75+
<span v-else>لايوجد</span>
76+
</td>
6677
<td class="align-middle">{{ order.order_number }}</td>
6778
<td class="align-middle">{{ $n(order.total_price, 'currency') }}</td>
79+
<td class="align-middle">{{ order.user.name }}</td>
80+
<td class="align-middle">
81+
<c-button variant-color="gray" size="xs" @click="getProducts(order.products), show = true" variant="ghost">
82+
<i class="fas fa-eye"></i>
83+
</c-button>
84+
</td>
6885
</tr>
6986
</tbody>
7087
</table>
@@ -86,18 +103,14 @@
86103
</div>
87104
</div>
88105
</div>
106+
</div>
89107
</template>
90108

91109
<script>
92110
import { mapMutations, mapGetters, mapActions, mapState } from "vuex";
93111
94112
export default {
95113
computed: {
96-
...mapGetters({
97-
categories: "supermarket/categories/categories",
98-
products: "supermarket/products/products",
99-
}),
100-
101114
orders() {
102115
return this.$store.getters["supermarket/orders/orders"];
103116
},
@@ -110,6 +123,7 @@ export default {
110123
show: false,
111124
search: "",
112125
showProducts: [],
126+
selectedCustomer: -1,
113127
114128
// Pagination
115129
paginatedData: [],
@@ -121,14 +135,7 @@ export default {
121135
this.show = false;
122136
},
123137
getProducts: function (products) {
124-
let fullProducts = products.map((x) => {
125-
return {
126-
product: this.products.find((y) => y.id == x.id),
127-
inCount: x.pivot.count,
128-
price: x.pivot.price,
129-
};
130-
});
131-
this.showProducts = fullProducts;
138+
this.showProducts = products;
132139
},
133140
...mapActions({
134141
fetchOrders: "supermarket/orders/fetchOrders",

0 commit comments

Comments
 (0)