End Urses Tab

This commit is contained in:
Diyar Akhgar 2025-05-27 03:31:58 +03:30
parent b0c893caaa
commit 0e0c45dba1
4 changed files with 1045 additions and 594 deletions

View File

@ -0,0 +1,336 @@
<template>
<div v-if="isVisible" class="modal-overlay" @click="close">
<div class="modal-content" @click.stop>
<div class="popUp-header">
<h2>کاربر جدید</h2>
<button @click="close">
<svg
xmlns="http://www.w3.org/2000/svg"
width="35"
height="35"
viewBox="0 0 32 32"
fill="none"
>
<rect x="0.5" y="0.5" width="31" height="31" rx="7.5" fill="#101010" />
<rect x="0.5" y="0.5" width="31" height="31" rx="7.5" stroke="#E2DEE9" />
<path
d="M21 11L11 21"
stroke="white"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M11 11L21 21"
stroke="white"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</button>
</div>
<div class="popUp-title">
<h2>دعوت کاربر جدید</h2>
<span>کاربر یک ایمیل دعوت برای فعال کردن حساب خود دریافت میکند.</span>
</div>
<div class="popUp-objects">
<form @submit.prevent="handleSubmit" autocomplete="off">
<div class="form-group">
<label for="full_name">نام و نام خانوادگی</label>
<input
id="full_name"
v-model="newUser.full_name"
type="text"
required
/>
</div>
<div class="form-group">
<label for="email">ایمیل</label>
<input
id="email"
v-model="newUser.email"
type="email"
required
style="text-align: left;"
/>
</div>
<div class="form-group">
<label for="phone">شماره تماس</label>
<input
id="phone"
v-model="newUser.phone"
type="tel"
required
/>
</div>
<div class="form-group">
<label for="job_title">عنوان شغلی</label>
<input
id="job_title"
v-model="newUser.job_title"
type="text"
required
/>
</div>
<div class="form-group" style="justify-content: normal;">
<span>مدیر</span>
<input
type="checkbox"
id="is_manager"
class="checkbox"
v-model="newUser.is_manager"
/>
<label for="is_manager" class="switch"></label>
</div>
<div class="form-group" style="justify-content: normal;">
<span>مجوز</span>
<input
type="checkbox"
id="has_permission"
class="checkbox"
v-model="newUser.has_permission"
/>
<label for="has_permission" class="switch"></label>
</div>
</form>
</div>
<div class="form-actions">
<button type="button" class="cancel-btn" @click="close">بازگشت</button>
<button type="submit" class="submit-btn" @click="handleSubmit">تایید</button>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'AddUserModal',
props: {
isVisible: {
type: Boolean,
default: false,
},
},
data() {
return {
newUser: {
full_name: '',
phone: '',
email: '',
job_title: '',
is_manager: false,
has_permission: false,
},
};
},
methods: {
close() {
this.newUser = {
full_name: '',
phone: '',
email: '',
job_title: '',
is_manager: false,
has_permission: false,
};
this.$emit('close');
},
handleSubmit() {
if (!this.newUser.full_name || !this.newUser.email || !this.newUser.phone || !this.newUser.job_title) {
alert('لطفاً تمام فیلدها را پر کنید.');
return;
}
this.$emit('add-user', { ...this.newUser });
console.log('اطلاعات کاربر اضافه شده:', JSON.stringify(this.newUser, null, 2));
this.close();
},
},
};
</script>
<style scoped>
.modal-overlay {
position: fixed;
inset: 0; /* جایگزین top: 0; left: 0; right: 0; bottom: 0 */
background: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.modal-content {
background: #F7F5FA;
border-radius: 20px;
width: 100%;
max-width: 700px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
direction: rtl;
padding-bottom: 1.5rem;
height: 95vh;
overflow-y: auto;
scrollbar-width: none;
-ms-overflow-style: none;
}
.modal-content::-webkit-scrollbar {
display: none;
}
.popUp-header {
display: flex;
align-items: center;
justify-content: space-between;
background-color: #101010;
color: #fff;
padding: 20px 26px;
margin-bottom: 1.5rem;
border-radius: 20px 20px 0 0;
}
.popUp-header h2 {
font-size: 22px;
}
.popUp-header button {
background-color: inherit; /* استفاده از inherit برای حذف تکرار #101010 */
border: none;
cursor: pointer;
}
.popUp-title {
display: flex;
flex-direction: column;
align-items: flex-start; /* اصلاح start به flex-start برای استاندارد بودن */
padding: 20px 50px 20px 20px;
}
.popUp-title h2 {
font-size: 20px;
font-weight: 600;
color: #101010;
}
.popUp-title span {
font-size: 16px;
font-weight: 500;
color: #4F5A69;
margin-top: 1rem;
}
.popUp-objects {
margin: 1rem auto 0; /* ترکیب margin-top و margin: auto */
padding: 20px;
background-color: #FFFFFF;
border-radius: 16px;
width: 100%;
max-width: 620px;
display: block;
}
.form-group {
margin-bottom: 3rem;
display: flex;
align-items: center;
justify-content: space-between;
}
.form-group label {
font-weight: 500;
width: 50%;
font-size: 16px;
}
.form-group input,
.form-group textarea {
width: 100%;
padding: 8px;
border: 1px solid #718096;
border-radius: 8px;
font-size: 1rem;
resize: none; /* برای textarea */
}
.form-group input {
height: 45px;
max-width: 22rem;
}
.form-group textarea {
height: 140px;
max-width: 25rem;
}
.form-group input:focus,
.form-group textarea:focus {
outline: none;
}
.form-actions {
display: flex;
justify-content: space-between;
padding: 20px 0 0;
width: 100%;
max-width: 620px;
margin: auto;
}
.submit-btn,
.cancel-btn {
border: none;
border-radius: 8px;
cursor: pointer;
height: 50px;
width: 47%;
font-weight: 500;
font-size: 18px;
text-align: center;
}
.submit-btn {
background-color: #3A57E8;
color: white;
}
.cancel-btn {
background-color: #EBEEFD;
color: #101010;
}
/* checkbox toggler */
.switch {
position : relative ;
display : inline-block;
width: 60px !important;
height: 25px;
background-color: #CCCCCC;
border-radius: 20px;
margin-right: 12.5rem;
}
.switch::after {
content: '';
position: absolute;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: white;
top: 2px;
right: 3px;
transition: all 0.3s;
}
.checkbox:checked + .switch::after {
right: 37px;
}
.checkbox:checked + .switch {
background-color: #3a57e8;
}
.checkbox {
display : none;
}
</style>

View File

@ -289,7 +289,7 @@ export default {
.form-actions {
display: flex;
justify-content: space-between;
padding: 20px;
padding: 20px 0px;
padding-bottom: 0;
width: 100%;
max-width: 620px;

View File

@ -0,0 +1,267 @@
<template>
<div class="card license-card">
<span>لایسنس های قابل استفاده : 0</span>
<div class="buy-subscription" @click="goToBuySubscription">
خرید اشتراک
<span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="25" viewBox="0 0 24 25" fill="none">
<path d="M12 19.5L5 12.5L12 5.5" stroke="#48BB78" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M19 12.5H5" stroke="#48BB78" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</span>
</div>
</div>
<div class="user-cards">
<div class="user-card" v-for="(user, index) in userList" :key="index">
<div class="user-card-header">
<img :src="user.avatar" class="user-avatar" alt="avatar" />
<div class="user-info-box">
<div class="user-info-tags">
<div class="user-name">{{ user.name }}</div>
<div class="user-email">{{ user.email }}</div>
</div>
<div class="user-activity">
<div class="user-role">{{ user.role }}</div>
<div class="user-version">{{ user.version }}</div>
</div>
</div>
</div>
<div class="user-footer">
<span>اکانت XRoom</span>
<div class="user-actions">
<button><i class="icon">
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 20 20" fill="none">
<path d="M16.666 5.83325H9.16602" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.666 14.1667H4.16602" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.166 16.6667C15.5467 16.6667 16.666 15.5475 16.666 14.1667C16.666 12.786 15.5467 11.6667 14.166 11.6667C12.7853 11.6667 11.666 12.786 11.666 14.1667C11.666 15.5475 12.7853 16.6667 14.166 16.6667Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5.83398 8.33325C7.2147 8.33325 8.33398 7.21396 8.33398 5.83325C8.33398 4.45254 7.2147 3.33325 5.83398 3.33325C4.45327 3.33325 3.33398 4.45254 3.33398 5.83325C3.33398 7.21396 4.45327 8.33325 5.83398 8.33325Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</i></button>
<button><i class="icon">
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 20 20" fill="none">
<path d="M2.5 5H17.5" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M15.8327 5V16.6667C15.8327 17.5 14.9993 18.3333 14.166 18.3333H5.83268C4.99935 18.3333 4.16602 17.5 4.16602 16.6667V5" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6.66602 5.00008V3.33341C6.66602 2.50008 7.49935 1.66675 8.33268 1.66675H11.666C12.4993 1.66675 13.3327 2.50008 13.3327 3.33341V5.00008" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8.33398 9.16675V14.1667" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.666 9.16675V14.1667" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</i></button>
</div>
</div>
</div>
<div class="user-card add-card" @click="openAddUserModal">
<span class="add-text"><span style="font-size: 23px;margin-left: 0.5rem;">+</span> اضافه کردن کاربر جدید</span>
</div>
</div>
<!-- Modal -->
<AddUserModal
:isVisible="isAddUserModalVisible"
@close="closeAddUserModal"
@add-user="submitNewUser"
/>
</template>
<script>
import AddUserModal from '@/components/AddUserModal.vue';
export default {
name: 'UsersTab',
components: {
AddUserModal,
},
props: {
userList: {
type: Array,
default: () => [],
},
},
data() {
return {
isAddUserModalVisible: false,
};
},
methods: {
openAddUserModal() {
this.isAddUserModalVisible = true;
},
closeAddUserModal() {
this.isAddUserModalVisible = false;
},
submitNewUser(user) {
this.$emit('add-user', user);
this.closeAddUserModal();
},
goToBuySubscription() {
this.$emit('change-tab', 'buy-subscription');
},
},
};
</script>
<style scoped>
/* User Info Section */
.user-info {
display: flex;
align-items: center;
gap: 10px;
}
.user-name {
font-size: 16px;
font-weight: 700;
color: #101010;
}
.user-email {
font-size: 14px;
font-weight: 500;
color: #4F5A69;
}
.user-info-tags,
.user-activity {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.user-activity {
padding-left: 2rem;
}
/* User Cards Section */
.user-cards {
display: flex;
flex-wrap: wrap;
gap: 2rem;
margin-top: 2.5rem;
justify-content: space-between;
}
.user-card {
background: #fff;
border-radius: 16px;
box-shadow: 0 1px 4px 0 #00000029;
width: 48%;
height: 158px;
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
}
.user-card-header {
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
}
.user-info-box {
display: flex;
flex-direction: row;
justify-content: space-between;
flex: 1;
align-items: center;
text-align: right;
gap: 4px;
}
.user-role {
color: #3a57e8;
font-weight: 600;
font-size: 17px;
}
.buy-subscription {
display: flex;
align-items: center;
color: #48bb78;
font-weight: 500;
cursor: pointer;
}
.buy-subscription span {
margin-right: 0.5rem;
}
.add-card {
display: flex;
align-items: center;
justify-content: center;
color: #3a57e8;
font-weight: 500;
font-size: 20px;
width: 48%;
height: 158px;
cursor: pointer;
}
.card {
background-color: white;
border: 1px solid #e2e8f0;
border-radius: 12px;
padding: 20px;
min-width: 200px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.add-text {
text-align: center;
cursor: pointer;
}
.license-card {
max-width: 1600px;
display: flex;
justify-content: space-between;
align-items: center;
}
.license-card span {
font-size: 17px;
}
/* User Footer Section */
.user-footer {
background: #3a57e8;
color: #fff;
border-radius: 0 0 12px 12px;
padding: 10px 10px 5px;
display: flex;
justify-content: space-between;
align-items: center;
}
.user-footer span {
font-size: 17px;
}
.user-actions button {
background: none;
border: none;
color: white;
font-size: 16px;
cursor: pointer;
}
/* User Avatar */
.user-avatar {
width: 70px;
height: 86px;
border-radius: 50%;
object-fit: cover;
flex-shrink: 0;
align-self: flex-end;
margin-top: 10px;
}
</style>

File diff suppressed because it is too large Load Diff