diff --git a/xroom-dashboard/src/components/Membership.vue b/xroom-dashboard/src/components/Membership.vue index 50c5953..7e35f8e 100644 --- a/xroom-dashboard/src/components/Membership.vue +++ b/xroom-dashboard/src/components/Membership.vue @@ -1,59 +1,106 @@ @@ -70,19 +117,87 @@ export default { subscriptionCount: { type: Number, required: true, + validator: (value) => value >= 0, }, teamMemberCapacity: { type: Number, required: true, + validator: (value) => value >= 0, }, isBillingModalVisible: { type: Boolean, - required: true, + default: false, }, }, + data() { + return { + translations: { + billing: { + title: 'جزئیات صورتحساب', + phone: 'شماره تماس', + email: 'ایمیل', + editButton: 'ویرایش جزئیات صورتحساب', + }, + memberships: { + title: 'عضویت‌ها', + active: 'اشتراک فعال است', + inactive: 'هنوز مجوزی فعال نیست. کاربران شما نمی‌توانند از XRoom با واترمارک استفاده کنند.', + manageButton: 'مدیریت عضویت‌ها', + }, + payment: { + title: 'روش پرداخت', + noMethod: 'هیچ روش پرداختی برای صورتحساب مرتبط نیست.', + }, + subscription: { + title: 'وضعیت اشتراک تیم', + total: 'ظرفیت کل تیم', + remaining: 'ظرفیت باقی‌مانده', + added: 'کاربران اضافه کرده', + users: 'کاربر', + noActive: 'شما اشتراک فعالی ندارین، لطفا اشتراک جدیدی خریداری نمایید.', + activeButton: 'اشتراک فعال دارید', + buyButton: 'خرید اشتراک جدید', + }, + error: { + fetchFailed: 'خطا در دریافت اطلاعات. لطفاً دوباره تلاش کنید.', + }, + }, + billingInfo: { + address: 'اصفهان، خیابان وحید، نبش خیابان حسین آباد، مجتمع عسگری ۳، واحد ۳ ۸۱۷۵۹۴۹۹۹۱', + phone: '۰۹۳۷۹۸۹۸۶۲۳', + email: 'aminimperator@gmail.com', + }, + paymentMethod: null, + hasActiveSubscription: false, + isLoading: false, + error: null, + }; + }, + computed: { + hasRemainingCapacity() { + return this.subscriptionCount - this.teamMemberCapacity > 0; + }, + remainingCapacity() { + return this.subscriptionCount - this.teamMemberCapacity; + }, + }, + created() { + this.simulateFetch(); + }, methods: { - changeTab(tabName) { - this.$emit('change-tab', tabName); + simulateFetch() { + // شبیه‌سازی دریافت داده‌ها + this.isLoading = true; + setTimeout(() => { + this.isLoading = false; + }, 1000); + }, + retryFetch() { + this.error = null; + this.simulateFetch(); + }, + navigateToSubscription() { + this.$emit('change-tab', 'buy-subscription'); }, openBillingModal() { this.$emit('update:isBillingModalVisible', true); @@ -90,41 +205,60 @@ export default { closeBillingModal() { this.$emit('update:isBillingModalVisible', false); }, + updateBillingInfo(newBillingInfo) { + this.billingInfo = { ...newBillingInfo }; + }, + manageMemberships() { + console.log('مدیریت عضویت‌ها'); + }, }, }; \ No newline at end of file