403Webshell
Server IP : 34.87.99.72  /  Your IP : 216.73.217.31
Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n
System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64
User : bitnami ( 1000)
PHP Version : 7.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/bitnami/apache/htdocs/app/resources/js/views/UserCredits/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/bitnami/apache/htdocs/app/resources/js/views/UserCredits/UserCreditList.vue
<template>
	<v-container fluid>
		<v-row align="center" justify="end">
			<v-col cols="12" md="auto">
				<v-btn
					class="text-capitalize" 
					color="primary" small
					@click="insertNewCredit()"
				>
					<v-icon left>mdi-plus</v-icon>New
				</v-btn>
			</v-col>
			<v-spacer></v-spacer>
			<v-col cols="auto">
				<w-action-btn-group
					:items="action_btn_group_items()"
				></w-action-btn-group>
			</v-col>
		</v-row>
		<v-card class="mt-4" color="transparent" flat>
			<v-data-table
				ref="dataTable"
				:headers="table_headers"
				:items="resourceDataSet_"
				:options.sync="settings_"
				:server-items-length="totalData_"
				:footer-props="{
					'items-per-page-options': [5, 10, 25, 50]
				}"
				:loading="model_loading_"
				disable-sort
				:item-class="row_classes_"
			>
				<template #[`item.created_at`]="{ item }">
					{{ $dayjs(item.created_at).format('YYYY-MM-DD hh:mma') }}
				</template>
				<template #[`item.action`]="{ item }">
					<v-btn icon small @click="viewMore_(item)">
						<v-icon small>mdi-eye</v-icon>
					</v-btn>
				</template>
			</v-data-table>
		</v-card>

		<!-- form dialog -->
		<v-dialog v-model="form_dialog_" max-width="550px" persistent>
			<UserCreditForm
				:item="form_item_" :action="form_action_" :visible.sync="form_dialog_"
				:credit-types="options_.addable_credit_type"
				@initialize="emitIntialize()"
			></UserCreditForm>
		</v-dialog>

		<!-- filter dialog -->
		<w-side-dialog
			v-model="filter_dialog"
			title="Filters"
			clearable
			@clear="initFilters()"
		>
			<template #default>
				<v-row dense>
					<template v-for="(filter,i) in filter_options">
						<v-col :key="i" cols="12">
							<v-select
								v-model="filters_[filter.model]"
								:label="filter.label"
								:items="filter.items"
								class="caption"
								outlined
								dense hide-details
							></v-select>
						</v-col>
					</template>
				</v-row>
			</template>
			<template #actions>
				<div class="text-right">
					<v-btn 
						rounded block color="primary"
						@click="searchData_()"
					>
						Apply
					</v-btn>
				</div>
			</template>
		</w-side-dialog>

		<!-- model info dialog -->
		<v-navigation-drawer
			v-model="view_dialog_"
			floating
			app
			right
			temporary
			:style="$vuetify.breakpoint.mdAndUp ? 'min-width: 350px;' : '' "
		>	
			<v-card height="100%">
				<pre>{{ view_item_ }}</pre>
			</v-card>
		</v-navigation-drawer>
	</v-container>
</template>

<script>
import WActionBtnGroup from "@components/WActionBtnGroup"
import WSideDialog from "@components/WSideDialog"
import { resourceMixin } from "@/js/mixins/ResourceMixin"
import { formActionMixin } from "@/js/mixins/FormActionMixin"
import { errorHandlerMixin } from "@/js/mixins/ErrorHandlerMixin"
import UserCreditForm from './UserCreditForm'
export default{
	components:{
		WActionBtnGroup,
		WSideDialog,
		UserCreditForm,
	},
	mixins: [
		resourceMixin,
		formActionMixin,
		errorHandlerMixin
	],
	props:{
		user: {
			type: Object,
			default: ()=>{
				return {}
			}
		},
	},
	data(){
		return {
			table_headers: [
				{ text: '#', value: 'id' },
				{ text: 'Type', value: 'type_name' },
				{ text: 'Amount', value: 'amount' },
				{ text: 'Created at', value: 'created_at' },
				// { text: 'Actions', value: 'action', class: 'text-center' },
			],

			filter_dialog: false,

			filter_options:[],
			sort_options:[],
		}
	},
	created(){
		this.getAllRefs_([
			this.getUserCreditTypeRefs()
		]).then(()=>{
			this.setupFilterBar()
			this.initFilters()
		}).then(()=>{
			this.initialize_()
		})
	},
	methods:{
		emitIntialize(){
			this.$emit('initialize')
			this.initialize_()
		},
		initFilters(){
			this.filters_ = {
				user_id : this.user.id || 0,
				type_id : null,
			}
		},
		getResourceData_(){
			let payload = {
				...this.setPagination_(),
				...this.search_,
				...this.filters_,
				...this.sort_,
			}
			this.model_loading_ = true
			this.$api.getUserCreditList(payload).then((res)=>{
				let { data, total } = res.data.result.creditList
				this.resourceDataSet_ = data
				this.totalData_ = total
			}).catch((err)=>{
				this.errorHandler_(err)
			}).finally(()=>{
				this.model_loading_ = false
			})
		},
		action_btn_group_items(){
			return [
				{
					icon: "mdi-refresh",
					disabled: this.model_loading_,
					action: () => { this.searchData_() }
				},
				{	
					icon: "mdi-filter-outline",
					action: () => { this.filter_dialog = true }
				},
			]
		},
		setupFilterBar(){
			this.filter_options = [
				{	
					cols: 12,
					model: "type_id",
					label: "Type",
					items: [ { value: null, text: "All" }, ...this.options_.credit_type || [] ],
				},
			]
		},
		insertNewCredit(){
			this.newItem_({
				user: this.user,
				type: this.options_.addable_credit_type[0],
				amount: 0,
			})
		},
		async getUserCreditTypeRefs(){
			await this.$api.getUserCreditRefs().then((res)=>{
				let result = res.data.result
				this.options_.credit_type = result
				this.options_.addable_credit_type = result.filter((item)=> [2,3].includes(item.value))
			}).catch((err)=>{
				this.errorHandler_(err)
			})
		},

	}
}
</script>

Youez - 2016 - github.com/yon3zu
LinuXploit