![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ts.corals.io/frontend/pages/users/_userid/ |
<template> <div> <PageHeader :title="user.full_name"/> <div class="table-responsive"> <table class="table border-bottom"> <thead> <tr> <th scope="col">First Name</th> <th scope="col">Last Name</th> <th scope="col">Email</th> <th scope="col">Status</th> <th scope="col">Role</th> <th scope="col">Position</th> <th scope="col">Employee Type</th> <th scope="col">Hourly Rate</th> <th scope="col">Salary</th> </tr> </thead> <tbody> <tr> <td>{{ user.name }}</td> <td>{{ user.last_name }}</td> <td>{{ user.email }}</td> <td><span v-html="user.status"></span></td> <td><span v-html="user.roles_as_labels"></span></td> <td>{{ user.position }}</td> <td>{{ user.employee_type_as_label }}</td> <td><span v-text="user.hourly_rate"></span></td> <td><span v-text="user.salary"></span></td> </tr> </tbody> </table> </div> <div class="d-flex flex-wrap"> <div class="px-2" v-for="project_with_client in user.projects_with_client"> <strong>{{ project_with_client.client }}</strong><br/> <span class="badge badge-primary mr-1" v-for="project in project_with_client.projects" :key="project.project_name"> {{ project.project_name }} </span> </div> </div> <LimitedActivities v-if="user.position && checkMemberRole" :user_id="user.id"/> <CoralsReportsDateForm @filter="filter" :form="form"/> <b-tabs content-class="mt-3" v-model="currentTabIndex" v-if="checkMemberRole"> <b-tab title="Dashboard" active> <div class="row"> <div class="col-md-12"> <b-tabs> <b-tab title="Projects" active> <projects-report class="mt-3" url="timesheet/users/get-user-projects" :form="form" v-if="showUserReport"/> </b-tab> <b-tab title="Activities" lazy> <activities-report class="mt-3" url="timesheet/users/get-user-activities" :form="form" v-if="showUserReport"/> </b-tab> </b-tabs> </div> </div> <div class="row"> <div class="col-md-3"> <EntriesHoursLineChart model="project" :params="chartDataParameters" v-if="showUserCharts"/> </div> <div class="col-md-3"> <activities-hours-charts-data v-if="showUserCharts" :params="chartDataParameters" :form="form" :urlKey="'limited-activities'" :user="user"/> </div> </div> </b-tab> <b-tab title="Entries"> <entries-index :entries-resource="entriesResource" v-if="showEntries"/> </b-tab> </b-tabs> </div> </template> <script> import EntriesIndex from "@/components/Entries/Index"; import PageHeader from "@/components/layout/PageHeader"; import PageSection from "@/components/layout/PageSection"; import LimitedActivities from "@/components/LimitedActivities/LimitedActivities"; import ActivitiesHoursChartsData from "@/components/ChartJS/ActivitiesHoursChartsData"; import EntriesHoursLineChart from "@/components/ChartJS/EntriesHoursLineChart"; import ProjectsReport from "@/components/Reports/ProjectsReport"; import ActivitiesReport from "@/components/Reports/ActivitiesReport"; import CoralsReportsDateForm from "@/components/CoralsForm/CoralsReportsDateForm"; export default { name: "index", components: { LimitedActivities, PageSection, PageHeader, EntriesIndex, ActivitiesHoursChartsData, ProjectsReport, ActivitiesReport, EntriesHoursLineChart, CoralsReportsDateForm }, async asyncData({params, $axios, redirect}) { let user = await $axios.get(`/users/${params.userid}`) .then(({data}) => { return data.data; }).catch((error) => { return redirect('/'); }); return { user } }, data() { return { form: this.$form({ period: 'currentMonth', from_date: '', to_date: '', is_limited: 0, user_id: this.$route.params.userid, }, {resetOnSuccess: false}), showUserReport: false, showUserCharts: false, showEntries: false, user_id: '', currentTabIndex: 0, limitedActivityData: {}, headersForLimitedActivityTable: {}, } }, methods: { filter() { this.showUserReport = false; this.showUserCharts = false; this.showEntries = false; this.$nextTick(() => { this.showUserReport = true; this.showUserCharts = true; this.showEntries = true; }); }, }, computed: { chartDataParameters() { let fromDate = this.form.from_date, toDate = this.form.to_date; if (fromDate !== null && typeof fromDate == 'object') { fromDate = this.form.from_date.toLocaleDateString(); } if (toDate !== null && typeof toDate == 'object') { toDate = this.form.to_date.toLocaleDateString(); } return { user_id: this.$route.params.userid, from_date: fromDate, to_date: toDate, is_limited: this.form.is_limited ? 1 : 0 } }, entriesResource() { return `/timesheet/users/${this.user.id}/entries?from_date=${this.form.from_date}&to_date=${this.form.to_date}` }, checkMemberRole() { if (this.user.roles_names.find(({name}) => name === 'member')) { return true; } }, } } </script> <style scoped> </style>