[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: index.vue
<template> <div class="mb-50"> <!-- breadcrumbs Start --> <breadcrumbs :items="breadcrumbs" :current="breadcrumbsCurrent" /> <!-- breadcrumbs end --> <div class="row"> <div class="col-lg-12"> <div class="card custom-card w-100"> <div class="card-header setings-header"> <div class="col-xl-4 col-4"> <h3 class="card-title"> {{ $t("cashbook.transactions.index.page_title") }} </h3> </div> <div class="col-xl-8 col-8 float-right text-right"> <div class="btn-group c-w-100"> <a @click="refreshTable()" href="#" v-tooltip="'Refresh'" class="btn btn-success" > <i class="fas fa-sync"></i> </a> <a href="/cashbook/transactions/pdf" v-tooltip="$t('common.export_table')" class="btn btn-secondary" > <i class="fas fa-file-export"></i> </a> <a @click="print" v-tooltip="$t('common.print_table')" class="btn btn-info" > <i class="fas fa-print"></i> </a> </div> </div> </div> <!-- /.card-header --> <div class="card-body position-relative"> <div class="row"> <div class="col-6 col-xl-4 mb-2"> <search v-model="query" @reset-pagination="resetPagination()" @reload="reload" /> </div> <div class="col-6 col-xl-8 mb-2 text-right"> <date-range-picker ref="picker" opens="left" :locale-data="locale" :minDate="minDate" :maxDate="maxDate" :singleDatePicker="false" :showWeekNumbers="false" :showDropdowns="true" :autoApply="true" v-model="dateRange" @update="updateValues" :linkedCalendars="true" class="c-w-100" > <template v-slot:input="picker" style="min-width: 350px"> {{ picker.startDate | startDate }} - {{ picker.endDate | endDate }} </template> </date-range-picker> </div> </div> <table-loading v-show="loading" /> <div class="table-responsive table-custom mt-3" id="printMe"> <table class="table"> <thead> <tr> <th>{{ $t("common.s_no") }}</th> <th>{{ $t("common.reason") }}</th> <th>{{ $t("common.date") }}</th> <th>{{ $t("common.type") }}</th> <th>{{ $t("common.account") }}</th> <th>{{ $t("common.amount") }}</th> <th>{{ $t("common.status") }}</th> <th class="text-right">{{ $t("common.created_by") }}</th> </tr> </thead> <tbody> <tr v-show="items.length" v-for="(data, i) in items" :key="i"> <td> <span v-if="pagination.current_page > 1"> {{ pagination.per_page * (pagination.current_page - 1) + (i + 1) }} </span> <span v-else>{{ i + 1 }}</span> </td> <td>{{ data.reason }}</td> <td> <span v-if="data.transactionDate">{{ data.transactionDate | moment("Do MMM, YYYY") }}</span> </td> <td> <span v-if="data.type === 1" class="badge bg-success">{{ $t("common.credit") }}</span> <span v-else class="badge bg-danger">{{ $t("common.debit") }}</span> </td> <td v-if="data.account">{{ data.account.label }}</td> <td>{{ data.amount | withCurrency }}</td> <td> <span v-if="data.status === 1" class="badge bg-success">{{ $t("common.active") }}</span> <span v-else class="badge bg-danger">{{ $t("common.in_active") }}</span> </td> <td v-if="data.user" class="text-right"> {{ data.user.name }} </td> </tr> <tr v-show="!loading && !items.length"> <td colspan="8"> <EmptyTable /> </td> </tr> </tbody> </table> </div> </div> <div class="card-footer"> <div class="dtable-footer"> <div class="form-group row display-per-page"> <label>{{ $t("per_page") }} </label> <div> <select @change="updatePerPager" v-model="perPage" class="form-control form-control-sm ml-1" > <option value="10">10</option> <option value="25">25</option> <option value="50">50</option> <option value="100">100</option> </select> </div> </div> <!-- pagination-start --> <pagination v-if="pagination && pagination.last_page > 1" :pagination="pagination" :offset="5" class="justify-flex-end" @paginate="paginate" /> <!-- pagination-end --> </div> </div> </div> </div> </div> </div> </template> <script> import moment from "moment"; import { mapGetters } from "vuex"; import i18n from "~/plugins/i18n"; import DateRangePicker from "vue2-daterange-picker"; export default { middleware: ["auth", "check-permissions"], metaInfo() { return { title: this.$t("cashbook.transactions.index.page_title") }; }, components: { DateRangePicker, }, data: () => ({ breadcrumbsCurrent: "cashbook.transactions.index.breadcrumbs_current", breadcrumbs: [ { name: "cashbook.transactions.index.breadcrumbs_first", url: "home", }, { name: "cashbook.transactions.index.breadcrumbs_second", url: "", }, { name: "cashbook.transactions.index.breadcrumbs_active", url: "", }, ], query: "", perPage: 10, minDate: moment(new Date("01-01-2021")).format("YYYY-MM-DD"), maxDate: moment().add(1, "days").format("YYYY-MM-DD"), dateRange: { startDate: "", endDate: "", }, locale: { direction: "ltr", format: "YYYY-MM-DD", separator: " - ", applyLabel: "Apply", cancelLabel: "Cancel", weekLabel: "W", customRangeLabel: "Custom Range", daysOfWeek: moment.weekdaysMin(), monthNames: moment.monthsShort(), firstDay: 1, }, }), filters: { startDate(val) { return val ? moment(val).format("YYYY-MM-DD") : i18n.t("common.from"); }, endDate(val) { return val ? moment(val).format("YYYY-MM-DD") : i18n.t("common.to"); }, }, // Map Getters computed: { ...mapGetters("operations", ["items", "loading", "pagination"]), }, watch: { // watch search data query: function (newQ, oldQ) { if (newQ === "") { if (this.dateRange.startDate && this.dateRange.endDate) { this.searchData(); } else { this.getData(); } } else { this.searchData(); } }, }, created() { this.getData(); }, methods: { // filter data for selected date range async updateValues() { this.dateRange.startDate = moment(this.dateRange.startDate).format( "YYYY-MM-DD" ); this.dateRange.endDate = moment(this.dateRange.endDate).format( "YYYY-MM-DD" ); this.searchData(); }, // refresh table refreshTable() { this.query = ""; this.dateRange.startDate = null; this.dateRange.endDate = null; this.query === "" ? this.getData() : this.searchData(); setTimeout( function () { this.dateRange.startDate = ""; this.dateRange.endDate = ""; }.bind(this), 500 ); }, // update per page count updatePerPager() { this.pagination.current_page = 1; this.query === "" ? this.getData() : this.searchData(); }, // get data async getData() { this.$store.state.operations.loading = true; let currentPage = this.pagination ? this.pagination.current_page : 1; await this.$store.dispatch("operations/fetchData", { path: "/api/transactions?page=", currentPage: currentPage + "&perPage=" + this.perPage, }); }, // Pagination async paginate() { this.query === "" ? this.getData() : this.searchData(); }, // Reset pagination async resetPagination() { this.pagination.current_page = 1; }, // search data async searchData() { this.$store.state.operations.loading = true; let currentPage = this.pagination ? this.pagination.current_page : 1; await this.$store.dispatch("operations/searchData", { path: "/api/transactions/search", term: this.query, currentPage: currentPage + "&perPage=" + this.perPage, startDate: this.dateRange.startDate, endDate: this.dateRange.endDate, }); }, // Reload after search async reload() { this.query = ""; await this.searchData(); }, // print table async print() { await this.$htmlToPaper("printMe"); }, }, }; </script>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.74 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002