<!-- Insert the vue core before vue-toasted -->
<script src="./dist/bgs-admin-lte-vue-ui-components.umd.js"></script>
<link rel="stylesheet" href="./bgs-admin-lte-vue-ui-components.css" />
<script>
Vue.use(window.bgsAdminLteVueUIComponents);
</script>
<bgs-widget-stats-card
header="header"
subheader="subheader"
:loader="loader"
class="col-xs-12 col-sm-4 col-md-3"
@bgs-widget-stats-item-click="itemClick"
@bgs-widget-stats-collapse="collapse"
>
<template v-slot:employee-card>
<!-- Π‘Π»ΠΎΡ Π΄Π»Ρ ΠΊΠ°ΡΡΠΎΡΠΊΠΈ ΡΠΎ ΡΡΠ°ΡΠΈΡΡΠΈΠΊΠΎΠΉ Π΄Π»Ρ ΡΠΎΡΡΡΠ΄Π½ΠΈΠΊΠ° -->
</template>
<template v-slot:buttons>
<!-- Π‘Π»ΠΎΡ Π΄Π»Ρ ΠΊΠ½ΠΎΠΏΠΎΠΊ -->
<span
role="button"
title="Show detailed statistics"
class="info-box-toolbar-button hover-translucent employee-statistics-show-details-button"
>
<i class="fa fa-list"></i>
</span>
</template>
<template>
<!-- Π‘Π»ΠΎΡ ΠΎΡΠ½ΠΎΠ²Π½ΠΎΠ³ΠΎ ΠΊΠΎΠ½ΡΠ΅Π½ΡΠ° -->
</template>
</bgs-widget-stats-card>
Property | Description |
---|---|
header | ΠΠ°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ |
subheader | ΠΠΎΠ΄ΠΏΠΈΡΡ |
loader | ΠΠ°Π³ΡΡΠ·ΡΠΈΠΊ |
@bgs-widget-stats-item-click | Π‘ΠΎΠ±ΡΡΠΈΠ΅ ΠΏΠΎ ΠΊΠ»ΠΈΠΊΡ Π½Π° Π°Π²Π°ΡΠ°ΡΠΊΡ |
@bgs-widget-stats-collapse | Π‘ΠΎΠ±ΡΡΠΈΠ΅ ΠΏΡΠΈ ΡΠ°Π·Π²ΠΎΡΠ°ΡΠΈΠ²Π°Π½ΠΈΠΈ/ΡΠ°Π·Π²ΠΎΡΠ°ΡΠΈΠ²Π°Π½ΠΈΠΈ ΠΏΠΎΠ΄ΡΠΈΠ½ΡΠ½Π½ΡΡ |
<bgs-widget-stats-employee-card
:header="30001"
icon="eye"
:link="{href: 'link'}"
class="bg-maroon"
@bgs-widget-stats-employee-card-click="clickCard"
>
<template v-slot:subheader>
<!-- Π‘Π»ΠΎΡ ΠΏΠΎΠ΄ΠΏΠΈΡΠΈ -->
<p>
Last modified 2 month ago
<br />on LNG
</p>
</template>
</bgs-widget-stats-employee-card>
Property | Description |
---|---|
header | ΠΠ°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ |
icon | ion ΠΈΠΊΠΎΠ½ΠΊΠ° |
link | ΠΠ±ΡΠ΅ΠΊΡ ΡΡΡΠ»ΠΊΠ° ( {link: 'http://link.eu', title: 'ΠΠ°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ'} ) |
@bgs-widget-stats-employee-card-click | Π‘ΠΎΠ±ΡΡΠΈΠ΅ ΠΏΠΎ ΠΊΠ»ΠΈΠΊΡ Π½Π° Π°Π²Π°ΡΠ°ΡΠΊΡ |
<bgs-widget-stats-employees :items="items"></bgs-widget-stats-employees>
Property | Description |
---|---|
items | ΠΠΏΡΠ΅Π΄Π΅Π»ΡΠ½Π½ΠΎΠ³ΠΎ Π²ΠΈΠ΄Π° ΠΌΠ°ΡΡΠΈΠ² ΠΎΠ±ΡΠ΅ΠΊΡΠΎΠ² (ΡΠΎΡΡΡΠ΄Π½ΠΈΠΊΠΎΠ²) |
<template>
<div id="app">
<bgs-widget-payment-by-contract-expire
:employees="employees"
:loader="loader"
:card="card"
@bgs-widget-stats-item-click="itemClick"
@bgs-widget-stats-collapse="collapse"
@bgs-widget-stats-employee-card-click="cardClick"
@bgs-widget-stats-refresh="refresh"
></bgs-widget-payment-by-contract-expire>
</div>
</template>
<script>
import axios from "axios";
let token = "";
axios.defaults.headers.common = { Authorization: `Bearer ${token}` };
export default {
name: "app",
data() {
return {
card: null,
employees: {
items: []
},
loader: false,
date: new Date().toISOString().split("T")[0],
userId: 1
};
},
async mounted() {
await this.load();
},
methods: {
itemClick() {},
collapse() {},
cardClick() {},
error(message) {
this.card = {
header: `Error: ${message}`,
type: "error"
};
},
refresh() {
this.load();
},
async load() {
this.loader = true;
try {
let response = await axios.get(
`http://bgs-auth.local/api/widget/payment-by-contract-expire/${
this.userId
}`,
{
params: {
"filter[paid]": false,
"filter[date_of_payment_by_contract_before]": this.date
}
}
);
if (response.status === 200) {
let { card, items } = response.data.data;
this.employees.items = items;
if (card) {
this.card = {
header: card.value,
subheader: "Total overdue sum",
type: card.value ? "danger" : null
};
}
}
} catch (error) {
this.error(error.response.statusText);
}
this.loader = false;
}
}
};
</script>
<template>
<bgs-widget-stats-card
header="header"
subheader="subheader"
:loader="loader"
class="col-xs-12 col-sm-4 col-md-3"
@bgs-widget-stats-item-click="itemClick"
@bgs-widget-stats-collapse="collapse"
>
<template v-slot:employee-card>
<bgs-widget-stats-employee-card
:header="30001"
icon="eye"
:link="{href: 'link'}"
class="bg-maroon"
@bgs-widget-stats-employee-card-click="clickCard"
>
<template v-slot:subheader>
<p>
Last modified 2 month ago
<br />on LNG
</p>
</template>
</bgs-widget-stats-employee-card>
</template>
<template v-slot:buttons>
<span
role="button"
title="Show detailed statistics"
class="info-box-toolbar-button hover-translucent employee-statistics-show-details-button"
>
<i class="fa fa-list"></i>
</span>
<span
role="button"
title="Set plan"
class="info-box-toolbar-button hover-translucent employee-statistics-show-planning-button"
>
<i class="fa fa-gears"></i>
</span>
<span
role="button"
title="Refresh"
class="info-box-toolbar-button hover-translucent employee-statistics-refresh-button"
>
<i class="fa fa-refresh"></i>
</span>
</template>
<template>
<bgs-widget-stats-employees :items="items"></bgs-widget-stats-employees>
</template>
</bgs-widget-stats-card>
</template>
<script>
import { setTimeout } from "timers";
export default {
mounted() {
//Π·Π°Π³ΡΡΠ·ΡΠΈΠΊ
this.loader = true;
//ΠΏΡΠΈΠΌΠ΅Ρ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ Π΄Π°Π½Π½ΡΡ
setTimeout(() => {
this.items = this.getItems();
this.loader = false;
}, 5000);
},
data() {
return {
// ΠΠ°Π³ΡΡΠ·ΡΠΈΠΊ
loader: false,
items: null
};
},
methods: {
//ΠΠ»ΠΈΠΊ ΠΏΠΎ Π°Π²Π°ΡΠ°ΡΠΊΠ΅
itemClick(item) {},
//Π‘ΠΎΠ±ΡΡΠΈΠ΅ ΠΏΡΠΈ ΡΠ°Π·Π²ΠΎΡΠΎΡΠ΅
collapse(item) {},
//ΠΠ»ΠΈΠΊ ΠΏΠΎ ΠΊΠ°ΡΡΠ΅
clickCard(e) {
// ΠΡΠΊΠ»ΡΡΠΈΡΡ ΡΡΠ°Π½Π΄Π°ΡΡΠ½ΠΎΠ΅ ΠΏΠΎΠ²Π΅Π΄Π΅Π½ΠΈΠ΅ ΠΊΠ»ΠΈΠΊΠ°
e.preventDefault();
},
getItems() {
return [
{
id: 1, // ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΡΠΉ id
active: true, // ΡΠ»Π°Π³ Π°ΠΊΡΠΈΠ²Π½ΠΎΡΡΠΈ
collapsed: false, // ΠΏΠΎΠΊΠ°Π·ΡΠ²Π°ΡΡ ΡΠ°Π·Π²ΡΡΠ½ΡΡΡΠΌ (ΠΏΠΎΠΊΠ°Π·ΡΠ²Π°ΡΡ ΡΠΏΠΈΡΠΎΠΊ ΡΠΎΡΡΡΠ΄Π½ΠΈΠΊΠΎΠ²)
avatar: "foto.jpg", // ΠΠ²Π°ΡΠ°ΡΠΊΠ°
name: "Name 1", // ΠΠΌΡ
data: "Data", // ΠΠ°Π½Π½ΡΠ΅ Π΄Π»Ρ ΠΏΠΎΠΊΠ°Π·Π°
collapsed_data: "expanded", // ΠΠ°Π½Π½ΡΠ΅, ΠΊΠΎΡΠΎΡΡΠ΅ Π±ΡΠ΄ΡΡ ΠΏΠΎΠΊΠ°Π·Π°Π½Ρ ΠΏΡΠΈ ΡΠ°ΡΠΊΡΡΡΠΎΠΌ ΡΠΏΠΈΡΠΊΠ΅ ΡΠΎΡΡΡΠ΄Π½ΠΈΠΊΠΎΠ²
other: [1, 2, 3], // Π»ΡΠ±ΡΠ΅ Π΄ΡΡΠ³ΠΈΠ΅ Π΄Π°Π½Π½ΡΠ΅, Π½Π΅ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΠΎ other
items: [
// ΠΠ»ΠΎΠΆΠ΅Π½Π½ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ
{
id: 2,
active: false,
collapsed: false,
avatar: "cb59bc5fefe8bab6abf2fbc2e93eb208/gDAc5YF0mgY.jpg",
name: "Name 12",
data: "text"
},
{
id: 3,
active: true,
collapsed: false,
avatar: "MAKJOEIRd9c.jpg",
name: "Name 13",
data: "text"
}
],
// Π³ΡΡΠΏΠΏΠ° ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² Π²Π½Π΅ ΠΈΠ΅ΡΠ°ΡΡ
ΠΈΠΈ, ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ, ΠΊΠΎΡΠΎΡΡΠ΅ ΠΏΠΎΠ΄ ΡΠ΅ΡΡΠΎΠΉ
disabledItems: [
{
id: 122, // ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΡΠΉ id
avatar: "MAKJOEIRd9c.jpg", // ΠΠ²Π°ΡΠ°ΡΠΊΠ°
name: "Name" // ΠΠΌΡ
}
]
},
{
id: 51,
active: true,
collapsed: false,
avatar: "IMG_1402.png",
name: "Name 14",
data: "data",
items: [
{
id: 52,
active: true,
collapsed: false,
avatar: "%D0%BE%D0%B3.png",
name: "Name 15",
data: "data",
items: [
{
id: 53,
active: true,
collapsed: false,
avatar: "xgFmfkZaEHg.jpg",
name: "Name 152",
data: "data"
},
{
id: 54,
active: false,
collapsed: false,
avatar: "IMG_0257-10-09-18-02-17.JPG",
name: "Name 1Π²Π°Ρ",
data: "data"
}
]
}
]
}
];
}
}
};
</script>