sample(847564): Upgrading vue showcase asset management project
This commit is contained in:
Родитель
3fca076437
Коммит
8b7c3f80ad
59
README.md
59
README.md
|
@ -1,22 +1,53 @@
|
||||||
# Asset Management System
|
|
||||||
A showcase application to track and visualize the software and hardware assets of an organization. This app was built using [Syncfusion Essential JS 2 Vue UI components](https://www.syncfusion.com/products/vue).
|
|
||||||
|
|
||||||
## Prerequisites
|
# Vue Showcase Sample Configuration
|
||||||
To run the application, [npm and node.js](https://docs.npmjs.com/getting-started/installing-node) are required. The node.js version 6.0.0 or above and the npm version 3.0.0 or above can be used.
|
|
||||||
|
|
||||||
## Build Setup
|
This application includes a sample of the Vue Showcase template along with essential configurations and router integration, designed to facilitate a seamless start for your own projects.
|
||||||
|
|
||||||
### Install dependencies
|
The Vue showcase demo can be accessed at the following location:
|
||||||
npm install
|
|
||||||
|
|
||||||
### Serve with hot reload at localhost:8080
|
[https://npmci.syncfusion.com/development/showcase/vue/sample_template/](https://npmci.syncfusion.com/development/showcase/vue/sample_template/)
|
||||||
Run `npm run serve` command to start the development server at http://localhost:8080. The app will be reloaded automatically when the source file is changed.
|
|
||||||
|
|
||||||
### Build for production with minification
|
## package.json
|
||||||
npm run build
|
|
||||||
|
|
||||||
## Demo
|
1. Should replace the name from `@syncfusion/ej2-vue-sample_template` to `@syncfusion/ej2-vue-{sample-name}`.
|
||||||
|
2. Should replace the description from `Essential JS 2 - Sample name` to `Essential JS 2 - {Your sample-Name}`.
|
||||||
|
3. Required ej2 component dependencies should be placed inside the `dependencies` section.
|
||||||
|
|
||||||
[Asset Management System](https://ej2.syncfusion.com/showcase/vue/assetmanagement)
|
### Source
|
||||||
|
|
||||||
Also please check out other showcase samples built using Essential JS 2 components [here](https://ej2.syncfusion.com/home/vue.html).
|
All components files related to your sample should be placed inside the `src` location.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To install the application dependencies, use the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and minifies for production
|
||||||
|
|
||||||
|
To build the application, use the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Lints and fixes files
|
||||||
|
|
||||||
|
To check the lint errors in the application, use the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and hot-reloads for development
|
||||||
|
|
||||||
|
To run the application in the browser, use the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run serve
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customize configuration
|
||||||
|
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"productOwner": "Maithiliy K"
|
||||||
|
}
|
17
package.json
17
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@syncfusion/ej2-vue-asset-management",
|
"name": "@syncfusion/ej2-vue-asset-management",
|
||||||
"version": "1.0.0",
|
"version": "0.1.0",
|
||||||
"description": "A Vue.js project",
|
"description": "Essential JS 2 - Asset management",
|
||||||
"author": "Syncfusion Inc.",
|
"author": "Syncfusion Inc.",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -22,9 +22,9 @@
|
||||||
"@syncfusion/ej2-vue-popups": "*",
|
"@syncfusion/ej2-vue-popups": "*",
|
||||||
"@syncfusion/ej2-vue-treemap": "*",
|
"@syncfusion/ej2-vue-treemap": "*",
|
||||||
"core-js": "^3.8.3",
|
"core-js": "^3.8.3",
|
||||||
"vue-router": "^3.0.1",
|
"vue": "^3.2.13",
|
||||||
"vue": "^2.6.14",
|
"vue-router": "^4.2.4",
|
||||||
"vuex": "^3.0.1"
|
"vuex": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.12.16",
|
"@babel/core": "^7.12.16",
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
"@vue/cli-service": "~5.0.0",
|
"@vue/cli-service": "~5.0.0",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-plugin-vue": "^8.0.3",
|
"eslint-plugin-vue": "^8.0.3",
|
||||||
"vue-template-compiler": "^2.6.14"
|
"vue-template-compiler": "^2.7.14"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
"node": true
|
"node": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:vue/essential",
|
"plugin:vue/vue3-essential",
|
||||||
"eslint:recommended"
|
"eslint:recommended"
|
||||||
],
|
],
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
|
@ -53,6 +53,7 @@
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"> 1%",
|
"> 1%",
|
||||||
"last 2 versions",
|
"last 2 versions",
|
||||||
"not dead"
|
"not dead",
|
||||||
|
"not ie 11"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Двоичные данные
public/favicon.ico
Двоичные данные
public/favicon.ico
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 4.2 KiB После Ширина: | Высота: | Размер: 6.4 KiB |
|
@ -2,13 +2,14 @@
|
||||||
<html lang="">
|
<html lang="">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<base href="./" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
<title>IT Asset Management - Essential JS 2 for Vue - Syncfusion</title>
|
<title>IT Asset Management - Essential JS 2 for Vue - Syncfusion</title>
|
||||||
<link rel="shortcut icon" href="static/favicon.ico" />
|
<link rel="shortcut icon" href="static/favicon.ico" />
|
||||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
|
||||||
<link href="https://cdn.syncfusion.com/ej2/fabric.css" rel="stylesheet"/>
|
<link href="https://cdn.syncfusion.com/ej2/23.1.36/fabric.css" rel="stylesheet"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|
245
src/App.vue
245
src/App.vue
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="app" v-on:click="closeMenus" :style="{ marginLeft: marginSize }">
|
<div v-on:click="closeMenus" :style="{ marginLeft: marginSize }">
|
||||||
<div class="control-section">
|
<div class="control-section">
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<title>IT Asset Management</title>
|
<title>IT Asset Management</title>
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
<!-- <span class="e-avatar e-avatar-circle"></span> -->
|
<!-- <span class="e-avatar e-avatar-circle"></span> -->
|
||||||
<div class="badge-block" v-on:click="toggleNotify()">
|
<div class="badge-block" v-on:click="toggleNotify()">
|
||||||
<div id="bell" class="sf-icon-Notification" :style="{ color: bellColor }"></div>
|
<div id="bell" class="sf-icon-Notification" :style="{ color: bellColor }"></div>
|
||||||
<span id="badge" class="e-badge e-badge-warning e-badge-notification e-badge-overlap">{{this.$store.state.activityData.length}} </span>
|
<span id="badge" class="e-badge e-badge-warning e-badge-notification e-badge-overlap">{{store.state.activityData.length}} </span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -480,13 +480,24 @@ line-height: 1;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
|
||||||
import { SidebarPlugin, AccordionPlugin } from '@syncfusion/ej2-vue-navigations'
|
import { SidebarComponent as EjsSidebar } from '@syncfusion/ej2-vue-navigations';
|
||||||
import { ListViewPlugin } from '@syncfusion/ej2-vue-lists'
|
import { ListViewComponent as EjsListview } from '@syncfusion/ej2-vue-lists';
|
||||||
import { enableRipple, Browser, L10n } from '@syncfusion/ej2-base'
|
import { enableRipple, Browser, L10n } from '@syncfusion/ej2-base';
|
||||||
import { ToastPlugin } from '@syncfusion/ej2-vue-notifications'
|
import { ToastComponent as EjsToast } from '@syncfusion/ej2-vue-notifications';
|
||||||
import Notification from '@/components/NotificationTemplate'
|
import Notification from '@/components/NotificationTemplate';
|
||||||
|
import { createApp, ref } from "vue";
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
|
const toastRef = ref(null);
|
||||||
|
const sidebarListObj = ref(null);
|
||||||
|
const notifybarObj = ref(null);
|
||||||
|
const sidebarInstance = ref(null);
|
||||||
|
const router = useRouter();
|
||||||
|
const store = useStore();
|
||||||
|
const app = createApp();
|
||||||
|
|
||||||
// Added for command Column tooltip
|
// Added for command Column tooltip
|
||||||
L10n.load({
|
L10n.load({
|
||||||
|
@ -495,14 +506,10 @@ L10n.load({
|
||||||
'edit': 'Edit'
|
'edit': 'Edit'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
Vue.use(ToastPlugin)
|
enableRipple(false);
|
||||||
Vue.use(AccordionPlugin)
|
var templateVue = app.component('menuTemplate', {
|
||||||
Vue.use(SidebarPlugin)
|
|
||||||
Vue.use(ListViewPlugin)
|
|
||||||
enableRipple(false)
|
|
||||||
var templateVue = Vue.component('menuTemplate', {
|
|
||||||
template: `
|
template: `
|
||||||
<div class="listWrapper" style="width: inherit;height: inherit;">
|
<div class="listWrapper" style="width: inherit;height: inherit;">
|
||||||
<span :class="[data.icon + ' list_svg']"></span>
|
<span :class="[data.icon + ' list_svg']"></span>
|
||||||
|
@ -513,113 +520,111 @@ var templateVue = Vue.component('menuTemplate', {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
data: {}
|
data: {}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
export default Vue.extend({
|
|
||||||
data: function () {
|
const accountList = [
|
||||||
return {
|
{ text: 'Profile', id: '001', icon: 'profile' },
|
||||||
accountList: [
|
{ text: 'Logout', id: '002', icon: 'logout' }
|
||||||
{ text: 'Profile', id: '001', icon: 'profile' },
|
];
|
||||||
{ text: 'Logout', id: '002', icon: 'logout' }
|
|
||||||
],
|
const dataList = [
|
||||||
dataList: [
|
{ text: 'Dashboard', id: '01', messages: '', badge: '', icon: 'sf-icon-Dashboard' },
|
||||||
{ text: 'Dashboard', id: '01', messages: '', badge: '', icon: 'sf-icon-Dashboard' },
|
{ text: 'Hardware', id: '02', messages: '', badge: '', icon: 'sf-icon-Hardware' },
|
||||||
{ text: 'Hardware', id: '02', messages: '', badge: '', icon: 'sf-icon-Hardware' },
|
{ text: 'Software', id: '03', messages: '', badge: '', icon: 'sf-icon-Software' },
|
||||||
{ text: 'Software', id: '03', messages: '', badge: '', icon: 'sf-icon-Software' },
|
{ text: 'Issued Licenses', id: '04', messages: '', badge: '', icon: 'sf-icon-License' },
|
||||||
{ text: 'Issued Licenses', id: '04', messages: '', badge: '', icon: 'sf-icon-License' },
|
{ text: 'Requests', id: '05', messages: store.getters.pendingRequests, badge: 'e-badge e-badge-warning', icon: 'sf-icon-Request' },
|
||||||
{ text: 'Requests', id: '05', messages: this.$store.getters.pendingRequests, badge: 'e-badge e-badge-warning', icon: 'sf-icon-Request' },
|
{ text: 'About', id: '06', messages: '', badge: '', icon: 'sf-icon-About' }
|
||||||
{ text: 'About', id: '06', messages: '', badge: '', icon: 'sf-icon-About' }
|
];
|
||||||
],
|
const fields = { iconCss: 'icon', tooltip: 'text' };
|
||||||
fields: { iconCss: 'icon', tooltip: 'text' },
|
const template = function() {
|
||||||
template: function () {
|
return { template: templateVue };
|
||||||
return { template: templateVue }
|
};
|
||||||
},
|
const type = Browser.isDevice ? 'Over' : 'Push';
|
||||||
type: Browser.isDevice ? 'Over' : 'Push',
|
const width = '170px';
|
||||||
width: '170px',
|
const dockSize = '170px';
|
||||||
name: 'App',
|
const enableDock = !Browser.isDevice;
|
||||||
dockSize: '170px',
|
const closeOnDocumentClick = true;
|
||||||
enableDock: !Browser.isDevice,
|
const position = {
|
||||||
closeOnDocumentClick: true,
|
|
||||||
position: {
|
|
||||||
X: 'Right'
|
X: 'Right'
|
||||||
},
|
};
|
||||||
showNotifyDlg: false,
|
let logoutPopup = ref(false);
|
||||||
logoutPopup: false,
|
let logoutPopupClicked = false;
|
||||||
logoutPopupClicked: false,
|
let notifyBellClicked = false;
|
||||||
notifyBellClicked: false,
|
let sidebarClicked = false;
|
||||||
sidebarClicked: false,
|
const isDevice = Browser.isDevice;
|
||||||
contextLeft: '1000px',
|
const showBackdrop = false;
|
||||||
isDevice: Browser.isDevice,
|
const sidebarTarget = Browser.isDevice ? '.content' : document.body;
|
||||||
showBackdrop: false,
|
const sidebarPosition = Browser.isDevice ? 'absolute' : 'fixed';
|
||||||
sidebarTarget: Browser.isDevice ? '.content' : document.body,
|
//const marginSize = Browser.isDevice ? '0px' : '170px';
|
||||||
sidebarPosition: Browser.isDevice ? 'absolute' : 'fixed',
|
const marginSize = '0px';
|
||||||
marginSize: Browser.isDevice ? '0px' : '170px',
|
const backColor = Browser.isDevice ? 'linear-gradient(-138deg, #3D8EC4 0%, #276AAB 100%)' : '#fff';
|
||||||
backColor: Browser.isDevice ? 'linear-gradient(-138deg, #3D8EC4 0%, #276AAB 100%)' : '#fff',
|
const bellColor = Browser.isDevice ? '#fff' : '#999999';
|
||||||
bellColor: Browser.isDevice ? '#fff' : '#999999'
|
|
||||||
|
function onComplete (args) {
|
||||||
|
var name = router.options.history.location.split('/');
|
||||||
|
name = name.length && name[1] ? name[1] : '';
|
||||||
|
var menuText;
|
||||||
|
for (let i = 0; i < args.data.length; i++) {
|
||||||
|
if (name === '') {
|
||||||
|
menuText = 'Dashboard';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
if (args.data[i].text === name) {
|
||||||
methods: {
|
menuText = args.data[i].text;
|
||||||
onComplete: function (args) {
|
break;
|
||||||
var name = this.$router.currentRoute.name
|
|
||||||
var menuId
|
|
||||||
for (let i = 0; i < args.data.length; i++) {
|
|
||||||
if (args.data[i].text === name) {
|
|
||||||
menuId = args.data[i].id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.$refs.sidebarListObj.selectItem({'id': menuId})
|
|
||||||
},
|
|
||||||
updatePendingRequests: function () {
|
|
||||||
for (let data of this.dataList) {
|
|
||||||
if (data['badge'] !== '') {
|
|
||||||
data['messages'] = this.$store.getters.pendingRequests
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Listview select event handler
|
|
||||||
onSelect: function (args) {
|
|
||||||
var vuePath = '/'
|
|
||||||
if (args.text !== 'Dashboard') {
|
|
||||||
vuePath += args.text.replace(' ', '')
|
|
||||||
}
|
|
||||||
this.$router.push({ path: vuePath }).catch(()=>{})
|
|
||||||
this.$refs.notifybarObj.hide()
|
|
||||||
},
|
|
||||||
openClick: function () {
|
|
||||||
this.$refs.sidebarInstance.toggle()
|
|
||||||
this.sidebarClicked = true
|
|
||||||
},
|
|
||||||
closeClick: function () {
|
|
||||||
this.$refs.sidebarInstance.hide()
|
|
||||||
},
|
|
||||||
closeMenus: function () {
|
|
||||||
if (!this.logoutPopupClicked) {
|
|
||||||
this.logoutPopup = false
|
|
||||||
}
|
|
||||||
if (!this.notifyBellClicked) {
|
|
||||||
this.$refs.notifybarObj.hide()
|
|
||||||
}
|
|
||||||
if (this.isDevice) {
|
|
||||||
if (!this.sidebarClicked) {
|
|
||||||
this.$refs.sidebarInstance.hide()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.logoutPopupClicked = false
|
|
||||||
this.notifyBellClicked = false
|
|
||||||
this.sidebarClicked = false
|
|
||||||
},
|
|
||||||
AccountMenu: function () {
|
|
||||||
this.logoutPopup = !this.logoutPopup
|
|
||||||
this.logoutPopupClicked = true
|
|
||||||
},
|
|
||||||
toggleNotify: function () {
|
|
||||||
this.$refs.notifybarObj.toggle()
|
|
||||||
this.notifyBellClicked = true
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
components: {
|
|
||||||
Notification
|
|
||||||
}
|
}
|
||||||
})
|
sidebarListObj.value.ej2Instance.selectItem({'text': menuText});
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function updatePendingRequests() {
|
||||||
|
for (let data of dataList) {
|
||||||
|
if (data['badge'] !== '') {
|
||||||
|
data['messages'] = store.getters.pendingRequests;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Listview select event handler
|
||||||
|
function onSelect(args) {
|
||||||
|
var vuePath = '/';
|
||||||
|
if (args.text !== 'Dashboard') {
|
||||||
|
vuePath += args.text.replace(' ', '');
|
||||||
|
}
|
||||||
|
router.push({ path: vuePath }).catch(()=>{});
|
||||||
|
notifybarObj.value.hide();
|
||||||
|
}
|
||||||
|
function openClick() {
|
||||||
|
sidebarInstance.value.toggle();
|
||||||
|
sidebarClicked = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line
|
||||||
|
function closeClick() {
|
||||||
|
sidebarInstance.value.hide();
|
||||||
|
}
|
||||||
|
function closeMenus() {
|
||||||
|
if (!logoutPopupClicked) {
|
||||||
|
logoutPopup.value = false;
|
||||||
|
}
|
||||||
|
if (!notifyBellClicked) {
|
||||||
|
notifybarObj.value.hide();
|
||||||
|
}
|
||||||
|
if (isDevice) {
|
||||||
|
if (!sidebarClicked) {
|
||||||
|
sidebarInstance.value.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logoutPopupClicked = false;
|
||||||
|
notifyBellClicked = false;
|
||||||
|
sidebarClicked = false;
|
||||||
|
}
|
||||||
|
function AccountMenu() {
|
||||||
|
logoutPopup.value = !logoutPopup.value;
|
||||||
|
logoutPopupClicked = true;
|
||||||
|
}
|
||||||
|
function toggleNotify() {
|
||||||
|
notifybarObj.value.toggle();
|
||||||
|
notifyBellClicked = true;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
|
@ -60,7 +60,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class='control-item'>
|
<div class='control-item'>
|
||||||
<span class="icon-listview e-sb-icon control-icon"></span>
|
<span class="icon-listview e-sb-icon control-icon"></span>
|
||||||
<a class='control-name' href="http://ej2.syncfusion.com/vue/documentation/list-view/getting-started.html" target="_blank">ListView</a>
|
<a class='control-name' href="http://ej2.syncfusion.com/vue/documentation/listview/getting-started.html" target="_blank">ListView</a>
|
||||||
</div>
|
</div>
|
||||||
<div class='control-item'>
|
<div class='control-item'>
|
||||||
<span class="icon-textboxes e-sb-icon control-icon"></span>
|
<span class="icon-textboxes e-sb-icon control-icon"></span>
|
||||||
|
@ -85,9 +85,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -32,24 +32,13 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="list-temp" >
|
<div class="list-temp" >
|
||||||
<div class="e-avatar e-avatar-small e-avatar-circle list-img" :style="{ background: 'url(' + image + ') no-repeat center', backgroundSize: bgSize, 'vertical-align': 'middle'}"></div>
|
<div class="e-avatar e-avatar-small e-avatar-circle list-img" :style="{ background: 'url(' + require('@/' + data.ImgSrc) + ') no-repeat center', backgroundSize: bgSize, 'vertical-align': 'middle'}"></div>
|
||||||
<span id= "list-engineer">{{data.Employee}}</span>
|
<span id= "list-engineer">{{data.Employee}}</span>
|
||||||
<span id="list-timeStamp" class="sf-icon-timer" >{{data.TimeStamp}}</span>
|
<span id="list-timeStamp" class="sf-icon-timer" >{{data.TimeStamp}}</span>
|
||||||
<p id="list-message">{{data.Message}}</p>
|
<p id="list-message">{{data.Message}}</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
const data = {};
|
||||||
data () {
|
const bgSize = 'cover';
|
||||||
return {
|
|
||||||
data: {},
|
|
||||||
bgSize: 'cover'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
image: function () {
|
|
||||||
return require('@/' + this.data.ImgSrc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
|
@ -4,7 +4,7 @@
|
||||||
<form id="formId" class="dlg-form" novalidate="">
|
<form id="formId" class="dlg-form" novalidate="">
|
||||||
<div class="col-lg-12 e-input-section">
|
<div class="col-lg-12 e-input-section">
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<div class="row" v-show="isEdit">
|
<div class="row" v-show="props.isEdit">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
|
||||||
<label class="e-text">Task ID</label>
|
<label class="e-text">Task ID</label>
|
||||||
<input id="taskID" class="e-input" type="text" disabled>
|
<input id="taskID" class="e-input" type="text" disabled>
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12" v-show="showAssignee">
|
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12" v-show="showAssignee">
|
||||||
<!-- <div class="e-float-input"> -->
|
<!-- <div class="e-float-input"> -->
|
||||||
<label class="e-text">Assigned To</label>
|
<label class="e-text">Assigned To</label>
|
||||||
<ejs-autocomplete id="assignee" :dataSource='this.$store.getters.empData' :fields='fields'></ejs-autocomplete>
|
<ejs-autocomplete id="assignee" :dataSource='store.getters.empData' :fields='fields'></ejs-autocomplete>
|
||||||
<!-- <span class="e-float-line"></span> -->
|
<!-- <span class="e-float-line"></span> -->
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
</div>
|
</div>
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
|
|
||||||
<div class="row pull-right">
|
<div class="row pull-right">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
|
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
|
||||||
<ejs-button id="primarybtn" :isPrimary="true" @click.native="addRecord">{{btnName}}</ejs-button>
|
<ejs-button id="primarybtn" :isPrimary="true" v-on:click="addRecord">{{btnName}}</ejs-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -101,239 +101,232 @@
|
||||||
</form>
|
</form>
|
||||||
</ejs-dialog>
|
</ejs-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { onMounted, computed, getCurrentInstance, ref } from 'vue';
|
||||||
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
|
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
|
||||||
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
|
import { DatePickerComponent as EjsDatepicker } from '@syncfusion/ej2-vue-calendars';
|
||||||
import { DropDownListPlugin } from '@syncfusion/ej2-vue-dropdowns'
|
import { DropDownListComponent as EjsDropdownlist } from '@syncfusion/ej2-vue-dropdowns';
|
||||||
import { DialogPlugin } from '@syncfusion/ej2-vue-popups'
|
import { DialogComponent as EjsDialog } from '@syncfusion/ej2-vue-popups';
|
||||||
import { UploaderPlugin, FormValidator } from '@syncfusion/ej2-vue-inputs'
|
import { UploaderComponent as EjsUploader, FormValidator } from '@syncfusion/ej2-vue-inputs';
|
||||||
import { ToastPlugin } from '@syncfusion/ej2-vue-notifications'
|
import { employeeData } from '../datasource.js';
|
||||||
import { employeeData } from '../datasource.js'
|
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
|
||||||
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
Vue.use(ToastPlugin)
|
const store = useStore();
|
||||||
Vue.use(DialogPlugin)
|
const root = getCurrentInstance();
|
||||||
Vue.use(DropDownListPlugin)
|
const dialogObj = ref(null);
|
||||||
Vue.use(DatePickerPlugin)
|
|
||||||
Vue.use(ButtonPlugin)
|
const categoryList = [
|
||||||
Vue.use(UploaderPlugin)
|
{ id: 'cat-1', text: 'Laptop' },
|
||||||
export default Vue.extend({
|
{ id: 'cat-2', text: 'Monitor' },
|
||||||
data: function () {
|
{ id: 'cat-3', text: 'Keyboard' },
|
||||||
return {
|
{ id: 'cat-4', text: 'Mouse' },
|
||||||
categoryList: [
|
{ id: 'cat-5', text: 'Tablet' },
|
||||||
{ id: 'cat-1', text: 'Laptop' },
|
{ id: 'cat-6', text: 'Mobile' },
|
||||||
{ id: 'cat-2', text: 'Monitor' },
|
{ id: 'cat-7', text: 'Headset' },
|
||||||
{ id: 'cat-3', text: 'Keyboard' },
|
{ id: 'cat-8', text: 'Miscellaneous' }
|
||||||
{ id: 'cat-4', text: 'Mouse' },
|
];
|
||||||
{ id: 'cat-5', text: 'Tablet' },
|
const statusList = [
|
||||||
{ id: 'cat-6', text: 'Mobile' },
|
{ id: 'stat-1', text: 'Ordered' },
|
||||||
{ id: 'cat-7', text: 'Headset' },
|
{ id: 'stat-2', text: 'Pending' },
|
||||||
{ id: 'cat-8', text: 'Miscellaneous' }
|
{ id: 'stat-3', text: 'Assigned' },
|
||||||
],
|
{ id: 'stat-4', text: 'In-repair' }
|
||||||
statusList: [
|
];
|
||||||
{ id: 'stat-1', text: 'Ordered' },
|
let header = 'Add New Hardware';
|
||||||
{ id: 'stat-2', text: 'Pending' },
|
const target = document.body;
|
||||||
{ id: 'stat-3', text: 'Assigned' },
|
const showCloseIcon = true;
|
||||||
{ id: 'stat-4', text: 'In-repair' }
|
const width = '500px';
|
||||||
],
|
let btnName = 'Submit';
|
||||||
header: 'Add New Hardware',
|
const animationSettings = { effect: 'None' };
|
||||||
target: document.body,
|
const isModal = true;
|
||||||
showCloseIcon: true,
|
const maxDate = new Date();
|
||||||
width: '500px',
|
const fields = {value: 'Employee'};
|
||||||
btnName: 'Submit',
|
const options = {
|
||||||
animationSettings: { effect: 'None' },
|
// Initialize the CustomPlacement.
|
||||||
isModal: true,
|
customPlacement: function (inputElement, errorElement) {
|
||||||
maxDate: new Date(),
|
inputElement.parentNode.appendChild(errorElement)
|
||||||
fields: {value: 'Employee'},
|
|
||||||
options: {
|
|
||||||
// Initialize the CustomPlacement.
|
|
||||||
customPlacement: function (inputElement, errorElement) {
|
|
||||||
inputElement.parentNode.appendChild(errorElement)
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
Name: { required: true },
|
|
||||||
Serial: { required: true },
|
|
||||||
Invoice: { required: true },
|
|
||||||
DOP: { required: true, date: true }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
frmObj: undefined,
|
|
||||||
showUploader: false,
|
|
||||||
showAssignee: false,
|
|
||||||
path: {
|
|
||||||
saveUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save',
|
|
||||||
removeUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove'
|
|
||||||
},
|
|
||||||
dropElement: '.content-wrapper'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted: function () {
|
rules: {
|
||||||
this.frmObj = new FormValidator('#formId', this.options)
|
Name: { required: true },
|
||||||
},
|
Serial: { required: true },
|
||||||
methods: {
|
Invoice: { required: true },
|
||||||
onChange: function () {
|
DOP: { required: true, date: true }
|
||||||
if (document.getElementById('status').value === 'In-repair') {
|
|
||||||
this.showAssignee = false
|
|
||||||
this.showUploader = true
|
|
||||||
document.querySelector('.e-file-drop').innerHTML = ' Or Drop files here'
|
|
||||||
} else if (document.getElementById('status').value === 'Assigned') {
|
|
||||||
this.showUploader = false
|
|
||||||
this.showAssignee = true
|
|
||||||
} else {
|
|
||||||
this.showUploader = false
|
|
||||||
this.showAssignee = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onFileRemove: function (args) {
|
|
||||||
args.postRawFile = false
|
|
||||||
},
|
|
||||||
created: function () {
|
|
||||||
},
|
|
||||||
dialogClose: function () {
|
|
||||||
this.$emit('close')
|
|
||||||
},
|
|
||||||
dialogOpen: function () {
|
|
||||||
this.frmObj.reset()
|
|
||||||
if (!this.isEdit) {
|
|
||||||
this.header = 'Add New Hardware'
|
|
||||||
this.btnName = 'Submit'
|
|
||||||
document.getElementById('name').value = ''
|
|
||||||
document.getElementById('category').value = 'Laptop'
|
|
||||||
document.getElementById('serial').value = ''
|
|
||||||
document.getElementById('invoice').value = ''
|
|
||||||
document.getElementById('dop').value = new Date().toLocaleDateString()
|
|
||||||
document.getElementById('weo').value = ''
|
|
||||||
document.getElementById('status').value = 'Ordered'
|
|
||||||
document.getElementById('assignee').value = ''
|
|
||||||
document.getElementById('note').value = ''
|
|
||||||
} else {
|
|
||||||
this.header = 'Edit Hardware'
|
|
||||||
this.btnName = 'Save'
|
|
||||||
var row = this.rowData
|
|
||||||
document.getElementById('taskID').value = row['TaskID']
|
|
||||||
document.getElementById('name').value = row['Name']
|
|
||||||
document.getElementById('category').value = row['Category']
|
|
||||||
document.getElementById('serial').value = row['SerialNo']
|
|
||||||
document.getElementById('invoice').value = row['InvoiceNo']
|
|
||||||
document.getElementById('dop').value = row['DOP'].toLocaleDateString()
|
|
||||||
document.getElementById('weo').value = row['WEO'] !== '' ? row['WEO'].toLocaleDateString() : ''
|
|
||||||
document.getElementById('status').value = row['Status']
|
|
||||||
document.getElementById('assignee').value = row['AssignedTo']
|
|
||||||
document.getElementById('note').value = row['Note']
|
|
||||||
}
|
|
||||||
if (document.getElementById('status').value === 'In-repair') {
|
|
||||||
this.showAssignee = false
|
|
||||||
this.showUploader = true
|
|
||||||
document.querySelector('.e-file-drop').innerHTML = ' Or Drop files here'
|
|
||||||
} else if (document.getElementById('status').value === 'Assigned') {
|
|
||||||
this.showUploader = false
|
|
||||||
this.showAssignee = true
|
|
||||||
} else {
|
|
||||||
this.showUploader = false
|
|
||||||
this.showAssignee = false
|
|
||||||
}
|
|
||||||
this.$refs.dialogObj.show()
|
|
||||||
},
|
|
||||||
addRecord: function () {
|
|
||||||
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
|
|
||||||
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
|
|
||||||
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
|
|
||||||
if (this.frmObj.validate()) {
|
|
||||||
var id = this.$store.state.activityData.length
|
|
||||||
if (!this.isEdit) {
|
|
||||||
grid.addRecord({
|
|
||||||
'TaskID': grid.dataSource.length + 1,
|
|
||||||
'Name': document.getElementById('name').value,
|
|
||||||
'Category': document.getElementById('category').value,
|
|
||||||
'SerialNo': document.getElementById('serial').value,
|
|
||||||
'InvoiceNo': document.getElementById('invoice').value,
|
|
||||||
'DOP': new Date(document.getElementById('dop').value),
|
|
||||||
'WEO': new Date(document.getElementById('weo').value),
|
|
||||||
'Status': document.getElementById('status').value,
|
|
||||||
'AssignedTo': document.getElementById('assignee').value,
|
|
||||||
'Note': document.getElementById('note').value
|
|
||||||
})
|
|
||||||
var activity = {
|
|
||||||
'id': id,
|
|
||||||
'Employee': userName,
|
|
||||||
'ImgSrc': userImg,
|
|
||||||
'TimeStamp': new Date().toLocaleDateString(),
|
|
||||||
'Message': 'A new hardware ' + document.getElementById('name').value + ' has been added'
|
|
||||||
}
|
|
||||||
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
|
||||||
this.$root.$children[0].$refs.toastRef.show({
|
|
||||||
title: 'Successs!',
|
|
||||||
content: 'Hardware added successfully',
|
|
||||||
cssClass: 'e-toast-success',
|
|
||||||
icon: 'e-success toast-icons'
|
|
||||||
})
|
|
||||||
}).catch((reason) => {
|
|
||||||
alert(reason)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
var data = {'TaskID': +document.getElementById('taskID').value,
|
|
||||||
'Name': document.getElementById('name').value,
|
|
||||||
'Category': document.getElementById('category').value,
|
|
||||||
'SerialNo': document.getElementById('serial').value,
|
|
||||||
'InvoiceNo': document.getElementById('invoice').value,
|
|
||||||
'DOP': new Date(document.getElementById('dop').value),
|
|
||||||
'WEO': new Date(document.getElementById('weo').value),
|
|
||||||
'Status': document.getElementById('status').value,
|
|
||||||
'AssignedTo': document.getElementById('assignee').value,
|
|
||||||
'Note': document.getElementById('note').value
|
|
||||||
}
|
|
||||||
var index = grid.selectedRowIndex
|
|
||||||
grid.editModule.updateRow(index, data)
|
|
||||||
activity = {
|
|
||||||
'id': id,
|
|
||||||
'Employee': userName,
|
|
||||||
'ImgSrc': userImg,
|
|
||||||
'TimeStamp': new Date().toLocaleDateString(),
|
|
||||||
'Message': 'The hardware ' + document.getElementById('name').value + ' has been edited'
|
|
||||||
}
|
|
||||||
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
|
||||||
this.$root.$children[0].$refs.toastRef.show({
|
|
||||||
title: 'Successs!',
|
|
||||||
content: 'Hardware updated successfully',
|
|
||||||
cssClass: 'e-toast-success',
|
|
||||||
icon: 'e-success toast-icons'
|
|
||||||
})
|
|
||||||
}).catch((reason) => {
|
|
||||||
alert(reason)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.frmObj.reset()
|
|
||||||
this.$refs.dialogObj.hide()
|
|
||||||
this.$emit('close')
|
|
||||||
// } else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
/** Whether the dialog is currently showing */
|
|
||||||
showing: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
isEdit: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
rowData: {
|
|
||||||
type: Object,
|
|
||||||
required: false,
|
|
||||||
default: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShowing () {
|
|
||||||
return this.showing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
};
|
||||||
|
|
||||||
|
let frmObj = undefined;
|
||||||
|
let showUploader = false;
|
||||||
|
let showAssignee = false;
|
||||||
|
const path = {
|
||||||
|
saveUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save',
|
||||||
|
removeUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove'
|
||||||
|
};
|
||||||
|
const dropElement = '.content-wrapper';
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
onMounted(() => {
|
||||||
|
frmObj = new FormValidator('#formId', options);
|
||||||
|
});
|
||||||
|
function onChange() {
|
||||||
|
if (document.getElementById('status').value === 'In-repair') {
|
||||||
|
showAssignee = false;
|
||||||
|
showUploader = true;
|
||||||
|
document.querySelector('.e-file-drop').innerHTML = ' Or Drop files here';
|
||||||
|
} else if (document.getElementById('status').value === 'Assigned') {
|
||||||
|
showUploader = false;
|
||||||
|
showAssignee = true;
|
||||||
|
} else {
|
||||||
|
showUploader = false;
|
||||||
|
showAssignee = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onFileRemove(args) {
|
||||||
|
args.postRawFile = false;
|
||||||
|
}
|
||||||
|
function dialogClose() {
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
function dialogOpen() {
|
||||||
|
frmObj.reset();
|
||||||
|
if (!props.isEdit) {
|
||||||
|
header = 'Add New Hardware';
|
||||||
|
btnName = 'Submit';
|
||||||
|
document.getElementById('name').value = '';
|
||||||
|
document.getElementById('category').value = 'Laptop';
|
||||||
|
document.getElementById('serial').value = '';
|
||||||
|
document.getElementById('invoice').value = '';
|
||||||
|
document.getElementById('dop').value = new Date().toLocaleDateString();
|
||||||
|
document.getElementById('weo').value = '';
|
||||||
|
document.getElementById('status').value = 'Ordered';
|
||||||
|
document.getElementById('assignee').value = '';
|
||||||
|
document.getElementById('note').value = '';
|
||||||
|
} else {
|
||||||
|
header = 'Edit Hardware';
|
||||||
|
btnName = 'Save';
|
||||||
|
var row = props.rowData;
|
||||||
|
document.getElementById('taskID').value = row['TaskID'];
|
||||||
|
document.getElementById('name').value = row['Name'];
|
||||||
|
document.getElementById('category').value = row['Category'];
|
||||||
|
document.getElementById('serial').value = row['SerialNo'];
|
||||||
|
document.getElementById('invoice').value = row['InvoiceNo'];
|
||||||
|
document.getElementById('dop').value = row['DOP'].toLocaleDateString();
|
||||||
|
document.getElementById('weo').value = row['WEO'] !== '' ? row['WEO'].toLocaleDateString() : '';
|
||||||
|
document.getElementById('status').value = row['Status'];
|
||||||
|
document.getElementById('assignee').value = row['AssignedTo'];
|
||||||
|
document.getElementById('note').value = row['Note'];
|
||||||
|
}
|
||||||
|
if (document.getElementById('status').value === 'In-repair') {
|
||||||
|
showAssignee = false;
|
||||||
|
showUploader = true;
|
||||||
|
document.querySelector('.e-file-drop').innerHTML = ' Or Drop files here';
|
||||||
|
} else if (document.getElementById('status').value === 'Assigned') {
|
||||||
|
showUploader = false;
|
||||||
|
showAssignee = true;
|
||||||
|
} else {
|
||||||
|
showUploader = false;
|
||||||
|
showAssignee = false;
|
||||||
|
}
|
||||||
|
dialogObj.value.show();
|
||||||
|
}
|
||||||
|
function addRecord() {
|
||||||
|
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
|
||||||
|
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
|
||||||
|
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
|
||||||
|
if (frmObj.validate()) {
|
||||||
|
var id = store.state.activityData.length;
|
||||||
|
if (!props.isEdit) {
|
||||||
|
grid.addRecord({
|
||||||
|
'TaskID': grid.dataSource.length + 1,
|
||||||
|
'Name': document.getElementById('name').value,
|
||||||
|
'Category': document.getElementById('category').value,
|
||||||
|
'SerialNo': document.getElementById('serial').value,
|
||||||
|
'InvoiceNo': document.getElementById('invoice').value,
|
||||||
|
'DOP': new Date(document.getElementById('dop').value),
|
||||||
|
'WEO': new Date(document.getElementById('weo').value),
|
||||||
|
'Status': document.getElementById('status').value,
|
||||||
|
'AssignedTo': document.getElementById('assignee').value,
|
||||||
|
'Note': document.getElementById('note').value
|
||||||
|
});
|
||||||
|
var activity = {
|
||||||
|
'id': id,
|
||||||
|
'Employee': userName,
|
||||||
|
'ImgSrc': userImg,
|
||||||
|
'TimeStamp': new Date().toLocaleDateString(),
|
||||||
|
'Message': 'A new hardware ' + document.getElementById('name').value + ' has been added'
|
||||||
|
};
|
||||||
|
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
||||||
|
root.root.refs.toastRef.show({
|
||||||
|
title: 'Successs!',
|
||||||
|
content: 'Hardware added successfully',
|
||||||
|
cssClass: 'e-toast-success',
|
||||||
|
icon: 'e-success toast-icons'
|
||||||
|
});
|
||||||
|
}).catch((reason) => {
|
||||||
|
alert(reason)
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var data = {
|
||||||
|
'TaskID': +document.getElementById('taskID').value,
|
||||||
|
'Name': document.getElementById('name').value,
|
||||||
|
'Category': document.getElementById('category').value,
|
||||||
|
'SerialNo': document.getElementById('serial').value,
|
||||||
|
'InvoiceNo': document.getElementById('invoice').value,
|
||||||
|
'DOP': new Date(document.getElementById('dop').value),
|
||||||
|
'WEO': new Date(document.getElementById('weo').value),
|
||||||
|
'Status': document.getElementById('status').value,
|
||||||
|
'AssignedTo': document.getElementById('assignee').value,
|
||||||
|
'Note': document.getElementById('note').value
|
||||||
|
};
|
||||||
|
var index = grid.selectedRowIndex;
|
||||||
|
grid.editModule.updateRow(index, data);
|
||||||
|
activity = {
|
||||||
|
'id': id,
|
||||||
|
'Employee': userName,
|
||||||
|
'ImgSrc': userImg,
|
||||||
|
'TimeStamp': new Date().toLocaleDateString(),
|
||||||
|
'Message': 'The hardware ' + document.getElementById('name').value + ' has been edited'
|
||||||
|
};
|
||||||
|
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
||||||
|
root.root.refs.toastRef.show({
|
||||||
|
title: 'Successs!',
|
||||||
|
content: 'Hardware updated successfully',
|
||||||
|
cssClass: 'e-toast-success',
|
||||||
|
icon: 'e-success toast-icons'
|
||||||
|
});
|
||||||
|
}).catch((reason) => {
|
||||||
|
alert(reason)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
frmObj.reset();
|
||||||
|
dialogObj.value.hide();
|
||||||
|
// eslint-disable-next-line
|
||||||
|
debugger;
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const emit = defineEmits(['close']);
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const props = defineProps({
|
||||||
|
/** Whether the dialog is currently showing */
|
||||||
|
showing: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
isEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
rowData: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const isShowing = computed(() => {
|
||||||
|
return props.showing
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
|
|
||||||
<div class="row pull-right">
|
<div class="row pull-right">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
|
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
|
||||||
<ejs-button id="primarybtn" :isPrimary="true" @click.native="addRecord">{{btnName}}</ejs-button>
|
<ejs-button id="primarybtn" :isPrimary="true" v-on:click="addRecord">{{btnName}}</ejs-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -73,198 +73,192 @@
|
||||||
</form>
|
</form>
|
||||||
</ejs-dialog>
|
</ejs-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { onMounted, computed, getCurrentInstance, ref } from 'vue';
|
||||||
import { ButtonComponent, ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
|
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
|
||||||
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
|
import { DatePickerComponent as EjsDatepicker } from '@syncfusion/ej2-vue-calendars';
|
||||||
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
|
import { DropDownListComponent as EjsDropdownlist } from '@syncfusion/ej2-vue-dropdowns';
|
||||||
import { NumericTextBoxPlugin, FormValidator } from '@syncfusion/ej2-vue-inputs'
|
import { NumericTextBoxComponent as EjsNumerictextbox, FormValidator } from '@syncfusion/ej2-vue-inputs';
|
||||||
import { DialogPlugin } from '@syncfusion/ej2-vue-popups'
|
import { DialogComponent as EjsDialog } from '@syncfusion/ej2-vue-popups';
|
||||||
import { employeeData } from '../datasource.js'
|
import { employeeData } from '../datasource.js';
|
||||||
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
|
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
Vue.use(DialogPlugin)
|
const store = useStore();
|
||||||
Vue.component(DropDownListComponent)
|
const root = getCurrentInstance();
|
||||||
Vue.use(NumericTextBoxPlugin)
|
const dialogObj = ref(null);
|
||||||
Vue.use(DatePickerPlugin)
|
|
||||||
Vue.component(ButtonPlugin.name, ButtonComponent)
|
const categoryList = [
|
||||||
export default Vue.extend({
|
{ id: 'cat-1', text: 'Development' },
|
||||||
data: function () {
|
{ id: 'cat-2', text: 'Graphics' },
|
||||||
return {
|
{ id: 'cat-3', text: 'Accounting' },
|
||||||
categoryList: [
|
{ id: 'cat-4', text: 'HR' },
|
||||||
{ id: 'cat-1', text: 'Development' },
|
{ id: 'cat-5', text: 'Common' },
|
||||||
{ id: 'cat-2', text: 'Graphics' },
|
{ id: 'cat-6', text: 'Miscellaneous' }
|
||||||
{ id: 'cat-3', text: 'Accounting' },
|
];
|
||||||
{ id: 'cat-4', text: 'HR' },
|
const LicenseList = [
|
||||||
{ id: 'cat-5', text: 'Common' },
|
{ id: 'Lic-1', text: 'Free' },
|
||||||
{ id: 'cat-6', text: 'Miscellaneous' }
|
{ id: 'Lic-2', text: 'Yearly (User basis)' },
|
||||||
],
|
{ id: 'Lic-3', text: 'Lifetime' }
|
||||||
LicenseList: [
|
];
|
||||||
{ id: 'Lic-1', text: 'Free' },
|
let header = 'Add New Software';
|
||||||
{ id: 'Lic-2', text: 'Yearly (User basis)' },
|
const target = document.body;
|
||||||
{ id: 'Lic-3', text: 'Lifetime' }
|
const showCloseIcon = true;
|
||||||
],
|
let btnName = 'Submit';
|
||||||
header: 'Add New Software',
|
const width = '500px';
|
||||||
target: document.body,
|
const isModal = true;
|
||||||
showCloseIcon: true,
|
const options = {
|
||||||
btnName: 'Submit',
|
// Initialize the CustomPlacement.
|
||||||
width: '500px',
|
customPlacement: function (inputElement, errorElement) {
|
||||||
isModal: true,
|
inputElement.parentNode.appendChild(errorElement)
|
||||||
options: {
|
|
||||||
// Initialize the CustomPlacement.
|
|
||||||
customPlacement: function (inputElement, errorElement) {
|
|
||||||
inputElement.parentNode.appendChild(errorElement)
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
Name: { required: true },
|
|
||||||
DOP: { required: true, date: true }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
frmObj: undefined,
|
|
||||||
maxDate: new Date(),
|
|
||||||
animationSettings: { effect: 'None' }
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted: function () {
|
rules: {
|
||||||
this.frmObj = new FormValidator('#formId', this.options)
|
Name: { required: true },
|
||||||
},
|
DOP: { required: true, date: true }
|
||||||
methods: {
|
|
||||||
dialogClose: function () {
|
|
||||||
this.$emit('close')
|
|
||||||
},
|
|
||||||
dialogOpen: function () {
|
|
||||||
this.frmObj.reset()
|
|
||||||
if (!this.isEdit) {
|
|
||||||
this.header = 'Add New Software'
|
|
||||||
this.btnName = 'Submit'
|
|
||||||
document.getElementById('name').value = ''
|
|
||||||
document.getElementById('edition').value = ''
|
|
||||||
document.getElementById('version').value = ''
|
|
||||||
document.getElementById('vendor').value = ''
|
|
||||||
document.getElementById('license-type').value = 'Free'
|
|
||||||
document.getElementById('license-count').value = 0
|
|
||||||
document.getElementById('dop').value = new Date().toLocaleDateString()
|
|
||||||
document.getElementById('expired-on').value = ''
|
|
||||||
document.getElementById('category').value = 'Development'
|
|
||||||
document.getElementById('note').value = ''
|
|
||||||
} else {
|
|
||||||
this.header = 'Edit Software'
|
|
||||||
this.btnName = 'Save'
|
|
||||||
var row = this.rowData
|
|
||||||
document.getElementById('taskID').value = row['TaskID']
|
|
||||||
document.getElementById('name').value = row['Name']
|
|
||||||
document.getElementById('edition').value = row['Edition']
|
|
||||||
document.getElementById('version').value = row['Version']
|
|
||||||
document.getElementById('vendor').value = row['Vendor']
|
|
||||||
document.getElementById('license-type').value = row['LicenseType']
|
|
||||||
document.getElementById('license-count').value = row['LicenseCount']
|
|
||||||
document.getElementById('dop').value = row['DOP'].toLocaleDateString()
|
|
||||||
document.getElementById('expired-on').value = row['ExpiredOn'] !== '' ? row['ExpiredOn'].toLocaleDateString() : ''
|
|
||||||
document.getElementById('category').value = row['Category']
|
|
||||||
document.getElementById('note').value = row['Note']
|
|
||||||
}
|
|
||||||
this.$refs.dialogObj.show()
|
|
||||||
},
|
|
||||||
addRecord: function () {
|
|
||||||
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
|
|
||||||
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
|
|
||||||
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
|
|
||||||
if (this.frmObj.validate()) {
|
|
||||||
var id = this.$store.state.activityData.length
|
|
||||||
if (!this.isEdit) {
|
|
||||||
grid.addRecord({
|
|
||||||
'TaskID': grid.dataSource.length + 1,
|
|
||||||
'Name': document.getElementById('name').value,
|
|
||||||
'Edition': document.getElementById('edition').value,
|
|
||||||
'Version': document.getElementById('version').value,
|
|
||||||
'Vendor': document.getElementById('vendor').value,
|
|
||||||
'LicenseType': document.getElementById('license-type').value,
|
|
||||||
'LicenseCount': document.getElementById('license-count').value,
|
|
||||||
'DOP': new Date(document.getElementById('dop').value),
|
|
||||||
'ExpiredOn': new Date(document.getElementById('expired-on').value),
|
|
||||||
'Category': document.getElementById('category').value,
|
|
||||||
'Note': document.getElementById('note').value
|
|
||||||
})
|
|
||||||
var activity = {
|
|
||||||
'id': id,
|
|
||||||
'Employee': userName,
|
|
||||||
'ImgSrc': userImg,
|
|
||||||
'TimeStamp': new Date().toLocaleDateString(),
|
|
||||||
'Message': 'A new software ' + document.getElementById('name').value + ' has been added'
|
|
||||||
}
|
|
||||||
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
|
||||||
this.$root.$children[0].$refs.toastRef.show({
|
|
||||||
title: 'Successs!',
|
|
||||||
content: 'Software added successfully',
|
|
||||||
cssClass: 'e-toast-success',
|
|
||||||
icon: 'e-success toast-icons'
|
|
||||||
})
|
|
||||||
}).catch((reason) => {
|
|
||||||
alert(reason)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
var data = {'TaskID': +document.getElementById('taskID').value,
|
|
||||||
'Name': document.getElementById('name').value,
|
|
||||||
'Edition': document.getElementById('edition').value,
|
|
||||||
'Version': document.getElementById('version').value,
|
|
||||||
'Vendor': document.getElementById('vendor').value,
|
|
||||||
'LicenseType': document.getElementById('license-type').value,
|
|
||||||
'LicenseCount': document.getElementById('license-count').value,
|
|
||||||
'DOP': new Date(document.getElementById('dop').value),
|
|
||||||
'ExpiredOn': new Date(document.getElementById('expired-on').value),
|
|
||||||
'Category': document.getElementById('category').value,
|
|
||||||
'Note': document.getElementById('note').value
|
|
||||||
}
|
|
||||||
var index = grid.selectedRowIndex
|
|
||||||
grid.editModule.updateRow(index, data)
|
|
||||||
activity = {
|
|
||||||
'id': id,
|
|
||||||
'Employee': userName,
|
|
||||||
'ImgSrc': userImg,
|
|
||||||
'TimeStamp': new Date().toLocaleDateString(),
|
|
||||||
'Message': 'The Software ' + document.getElementById('name').value + ' has been updated'
|
|
||||||
}
|
|
||||||
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
|
||||||
this.$root.$children[0].$refs.toastRef.show({
|
|
||||||
title: 'Successs!',
|
|
||||||
content: 'Software updated successfully',
|
|
||||||
cssClass: 'e-toast-success',
|
|
||||||
icon: 'e-success toast-icons'
|
|
||||||
})
|
|
||||||
}).catch((reason) => {
|
|
||||||
alert(reason)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.frmObj.reset()
|
|
||||||
this.$refs.dialogObj.hide()
|
|
||||||
this.$emit('close')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
/** Whether the dialog is currently showing */
|
|
||||||
showing: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
isEdit: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
rowData: {
|
|
||||||
type: Object,
|
|
||||||
required: false,
|
|
||||||
default: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShowing () {
|
|
||||||
return this.showing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
};
|
||||||
|
let frmObj = undefined;
|
||||||
|
const maxDate = new Date();
|
||||||
|
const animationSettings = { effect: 'None' };
|
||||||
|
onMounted(() => {
|
||||||
|
frmObj = new FormValidator('#formId', options);
|
||||||
|
});
|
||||||
|
function dialogClose() {
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
function dialogOpen () {
|
||||||
|
frmObj.reset();
|
||||||
|
if (!props.isEdit) {
|
||||||
|
header = 'Add New Software';
|
||||||
|
btnName = 'Submit';
|
||||||
|
document.getElementById('name').value = '';
|
||||||
|
document.getElementById('edition').value = '';
|
||||||
|
document.getElementById('version').value = '';
|
||||||
|
document.getElementById('vendor').value = '';
|
||||||
|
document.getElementById('license-type').value = 'Free';
|
||||||
|
document.getElementById('license-count').value = 0;
|
||||||
|
document.getElementById('dop').value = new Date().toLocaleDateString();
|
||||||
|
document.getElementById('expired-on').value = '';
|
||||||
|
document.getElementById('category').value = 'Development';
|
||||||
|
document.getElementById('note').value = '';
|
||||||
|
} else {
|
||||||
|
header = 'Edit Software';
|
||||||
|
btnName = 'Save';
|
||||||
|
var row = props.rowData;
|
||||||
|
document.getElementById('taskID').value = row['TaskID'];
|
||||||
|
document.getElementById('name').value = row['Name'];
|
||||||
|
document.getElementById('edition').value = row['Edition'];
|
||||||
|
document.getElementById('version').value = row['Version'];
|
||||||
|
document.getElementById('vendor').value = row['Vendor'];
|
||||||
|
document.getElementById('license-type').value = row['LicenseType'];
|
||||||
|
document.getElementById('license-count').value = row['LicenseCount'];
|
||||||
|
document.getElementById('dop').value = row['DOP'].toLocaleDateString();
|
||||||
|
document.getElementById('expired-on').value = row['ExpiredOn'] !== '' ? row['ExpiredOn'].toLocaleDateString() : '';
|
||||||
|
document.getElementById('category').value = row['Category'];
|
||||||
|
document.getElementById('note').value = row['Note'];
|
||||||
|
}
|
||||||
|
dialogObj.value.show();
|
||||||
|
}
|
||||||
|
function addRecord() {
|
||||||
|
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
|
||||||
|
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
|
||||||
|
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
|
||||||
|
if (frmObj.validate()) {
|
||||||
|
var id = store.state.activityData.length;
|
||||||
|
if (!props.isEdit) {
|
||||||
|
grid.addRecord({
|
||||||
|
'TaskID': grid.dataSource.length + 1,
|
||||||
|
'Name': document.getElementById('name').value,
|
||||||
|
'Edition': document.getElementById('edition').value,
|
||||||
|
'Version': document.getElementById('version').value,
|
||||||
|
'Vendor': document.getElementById('vendor').value,
|
||||||
|
'LicenseType': document.getElementById('license-type').value,
|
||||||
|
'LicenseCount': document.getElementById('license-count').value,
|
||||||
|
'DOP': new Date(document.getElementById('dop').value),
|
||||||
|
'ExpiredOn': new Date(document.getElementById('expired-on').value),
|
||||||
|
'Category': document.getElementById('category').value,
|
||||||
|
'Note': document.getElementById('note').value
|
||||||
|
});
|
||||||
|
var activity = {
|
||||||
|
'id': id,
|
||||||
|
'Employee': userName,
|
||||||
|
'ImgSrc': userImg,
|
||||||
|
'TimeStamp': new Date().toLocaleDateString(),
|
||||||
|
'Message': 'A new software ' + document.getElementById('name').value + ' has been added'
|
||||||
|
};
|
||||||
|
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
||||||
|
root.root.refs.toastRef.show({
|
||||||
|
title: 'Successs!',
|
||||||
|
content: 'Software added successfully',
|
||||||
|
cssClass: 'e-toast-success',
|
||||||
|
icon: 'e-success toast-icons'
|
||||||
|
});
|
||||||
|
}).catch((reason) => {
|
||||||
|
alert(reason);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var data = {
|
||||||
|
'TaskID': +document.getElementById('taskID').value,
|
||||||
|
'Name': document.getElementById('name').value,
|
||||||
|
'Edition': document.getElementById('edition').value,
|
||||||
|
'Version': document.getElementById('version').value,
|
||||||
|
'Vendor': document.getElementById('vendor').value,
|
||||||
|
'LicenseType': document.getElementById('license-type').value,
|
||||||
|
'LicenseCount': document.getElementById('license-count').value,
|
||||||
|
'DOP': new Date(document.getElementById('dop').value),
|
||||||
|
'ExpiredOn': new Date(document.getElementById('expired-on').value),
|
||||||
|
'Category': document.getElementById('category').value,
|
||||||
|
'Note': document.getElementById('note').value
|
||||||
|
};
|
||||||
|
var index = grid.selectedRowIndex;
|
||||||
|
grid.editModule.updateRow(index, data);
|
||||||
|
activity = {
|
||||||
|
'id': id,
|
||||||
|
'Employee': userName,
|
||||||
|
'ImgSrc': userImg,
|
||||||
|
'TimeStamp': new Date().toLocaleDateString(),
|
||||||
|
'Message': 'The Software ' + document.getElementById('name').value + ' has been updated'
|
||||||
|
};
|
||||||
|
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
||||||
|
root.root.refs.toastRef.show({
|
||||||
|
title: 'Successs!',
|
||||||
|
content: 'Software updated successfully',
|
||||||
|
cssClass: 'e-toast-success',
|
||||||
|
icon: 'e-success toast-icons'
|
||||||
|
});
|
||||||
|
}).catch((reason) => {
|
||||||
|
alert(reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
frmObj.reset();
|
||||||
|
dialogObj.value.hide();
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const emit = defineEmits(['close']);
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const props = defineProps({
|
||||||
|
/** Whether the dialog is currently showing */
|
||||||
|
showing: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
isEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
rowData: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const isShowing = computed(() => {
|
||||||
|
return props.showing
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<template id="view-hardware">
|
<template id="view-hardware">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div id="dialog" style="padding:10px;position:absolute;">
|
<div id="dialog" style="padding:10px;position:absolute;">
|
||||||
<add-hardware :showing="dlgShow" :isEdit="isEditing" :rowData="rowData" @close="onDlgClose">
|
<add-hardware :showing="dlgShow" :isEdit="isEditing" :rowData="rowData" :close="onDlgClose">
|
||||||
</add-hardware>
|
</add-hardware>
|
||||||
</div>
|
</div>
|
||||||
<div class="row top-row">
|
<div class="row top-row">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Hardware</h3></div>
|
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Hardware</h3></div>
|
||||||
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
|
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
|
||||||
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click.native="AddBtnClick"> <span class="e-add-icon"></span> Add New Hardware</ejs-button>
|
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click="AddBtnClick"> <span class="e-add-icon"></span> Add New Hardware</ejs-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
|
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
|
||||||
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
|
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
|
||||||
<ejs-grid ref="gridObj" class="r-space" :load="onGridLoad" :toolbarClick="editToolClicked" :actionBegin='onActionBegin' :actionComplete='onload' :toolbar="toolbar" :dataSource='gridData' :query='query' :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
|
<ejs-grid ref="gridObj" class="r-space" :load="onGridLoad" :toolbarClick="editToolClicked" :actionBegin='onActionBegin' :toolbar="toolbar" :dataSource='gridData' :query='query' :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
|
||||||
<e-columns>
|
<e-columns>
|
||||||
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=90 :isPrimaryKey='true'></e-column>
|
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=90 :isPrimaryKey='true'></e-column>
|
||||||
<e-column field='Name' headerText='Hardware' :filter='filter' width=90 clipMode='EllipsisWithTooltip' :required='true'></e-column>
|
<e-column field='Name' headerText='Hardware' :filter='filter' width=90 clipMode='EllipsisWithTooltip' :required='true'></e-column>
|
||||||
|
@ -35,123 +35,104 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { ref, provide } from 'vue';
|
||||||
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
|
import { GridComponent as EjsGrid, ColumnsDirective as EColumns, ColumnDirective as EColumn, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids';
|
||||||
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
|
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
|
||||||
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
|
import { DateRangePickerComponent as EjsDaterangepicker } from '@syncfusion/ej2-vue-calendars';
|
||||||
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
|
import AddHardware from '@/components/AddHardware';
|
||||||
import AddHardware from '@/components/AddHardware'
|
import { hardwareData } from '../datasource.js';
|
||||||
import { hardwareData } from '../datasource.js'
|
import { Tooltip } from '@syncfusion/ej2-vue-popups';
|
||||||
import { TooltipPlugin, Tooltip } from '@syncfusion/ej2-vue-popups'
|
import { Browser } from '@syncfusion/ej2-base';
|
||||||
import { Browser } from '@syncfusion/ej2-base'
|
|
||||||
|
|
||||||
Vue.use(DateRangePickerPlugin)
|
const gridObj = ref(null);
|
||||||
Vue.use(GridPlugin)
|
const dlgShow = ref(false);
|
||||||
Vue.component(DropDownListComponent)
|
const isEditing = ref(false);
|
||||||
Vue.use(DatePickerPlugin)
|
const rowData = ref(null);
|
||||||
Vue.use(ButtonPlugin)
|
|
||||||
Vue.use(TooltipPlugin)
|
|
||||||
|
|
||||||
export default Vue.extend({
|
const waterMark = 'Select a range';
|
||||||
data: function () {
|
const gridData = hardwareData;
|
||||||
return {
|
// eslint-disable-next-line no-unused-vars
|
||||||
dlgShow: false,
|
let tooltip;
|
||||||
isEditing: false,
|
const editSettings = { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' };
|
||||||
rowData: null,
|
let toolbar = undefined;
|
||||||
waterMark: 'Select a range',
|
const pageSettings = { pageCount: 5, pageSize: 10 };
|
||||||
gridData: hardwareData,
|
let filterSettings = { type: 'Menu', columns: [] };
|
||||||
tooltip: '',
|
const filter = { type: 'CheckBox' };
|
||||||
editSettings: { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' },
|
const selectionSettings = { persistSelection: true };
|
||||||
toolbar: undefined,
|
const query = '';
|
||||||
editparams: { params: { popupHeight: '300px' } },
|
const commands = [{ type: 'edit', buttonOption: { iconCss: 'e-icons e-edit', cssClass: 'e-flat e-noback', click: editBtnClick } },
|
||||||
pageSettings: { pageCount: 5, pageSize: 10 },
|
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }];
|
||||||
filterSettings: { type: 'Menu', columns: [] },
|
|
||||||
filter: { type: 'CheckBox' },
|
function onGridLoad() {
|
||||||
selectionSettings: { persistSelection: true },
|
if (Browser.isDevice) {
|
||||||
query: '',
|
toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete'];
|
||||||
commands: [{ type: 'edit', buttonOption: { iconCss: 'e-icons e-edit', cssClass: 'e-flat e-noback', click: this.editBtnClick } },
|
gridObj.value.ej2Instances.columns[10].visible = false;
|
||||||
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }]
|
}
|
||||||
|
}
|
||||||
|
function onActionBegin(args) {
|
||||||
|
if (args.requestType === 'beginEdit') {
|
||||||
|
editBtnClick(args);
|
||||||
|
args.cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function dateRangeChanged(args) {
|
||||||
|
// check wheather the value is empty or not
|
||||||
|
if (args.startDate && args.endDate) {
|
||||||
|
var filter = [
|
||||||
|
{ field: 'DOP', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
|
||||||
|
{ field: 'DOP', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
|
||||||
|
];
|
||||||
|
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: filter };
|
||||||
|
} else {
|
||||||
|
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: [] };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function AddBtnClick() {
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
isEditing.value = false;
|
||||||
|
}
|
||||||
|
function editToolClicked(args) {
|
||||||
|
if (args.item.id === 'editTool') {
|
||||||
|
isEditing.value = true;
|
||||||
|
var rows = gridObj.value.ej2Instances.getSelectedRows()[0];
|
||||||
|
if (!rows) {
|
||||||
|
gridObj.value.ej2Instances.editModule.showDialog('EditOperationAlert', gridObj.value.ej2Instances.editModule.alertDObj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'));
|
||||||
|
rowData.value = rowObj.data;
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editBtnClick(args) {
|
||||||
|
isEditing.value = true;
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
if (args.type === 'actionBegin') {
|
||||||
|
rowData.value = args.rowData;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var target = args.target;
|
||||||
|
if (target.classList.contains('e-edit')) {
|
||||||
|
target = target.parentElement;
|
||||||
|
}
|
||||||
|
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'));
|
||||||
|
rowData.value = rowObj.data;
|
||||||
|
}
|
||||||
|
function onDlgClose () {
|
||||||
|
dlgShow.value = false;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function showTooltip(args) {
|
||||||
|
tooltip = new Tooltip({
|
||||||
|
beforeOpen: (e) => {
|
||||||
|
if (e.target.classList.contains('e-unboundcell') || e.target.lastChild.classList.contains('e-unboundcell')) {
|
||||||
|
// e.cancel = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
content: args.data['Note'].toString() }, args.row);
|
||||||
onGridLoad: function () {
|
}
|
||||||
if (Browser.isDevice) {
|
provide('grid', [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]);
|
||||||
this.toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete']
|
|
||||||
this.$refs.gridObj.ej2Instances.columns[10].visible = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onload: function () {
|
|
||||||
},
|
|
||||||
onActionBegin: function (args) {
|
|
||||||
if (args.requestType === 'beginEdit') {
|
|
||||||
this.editBtnClick(args)
|
|
||||||
args.cancel = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dateRangeChanged: function (args) {
|
|
||||||
// check wheather the value is empty or not
|
|
||||||
if (args.startDate && args.endDate) {
|
|
||||||
var filter = [
|
|
||||||
{ field: 'DOP', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
|
|
||||||
{ field: 'DOP', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
|
|
||||||
]
|
|
||||||
this.filterSettings = {type: 'Menu', columns: filter}
|
|
||||||
} else {
|
|
||||||
this.filterSettings = {type: 'Menu', columns: []}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
AddBtnClick: function () {
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
this.isEditing = false
|
|
||||||
},
|
|
||||||
editToolClicked: function (args) {
|
|
||||||
if (args.item.id === 'editTool') {
|
|
||||||
this.isEditing = true
|
|
||||||
var rows = this.$refs.gridObj.ej2Instances.getSelectedRows()[0]
|
|
||||||
if (!rows) {
|
|
||||||
this.$refs.gridObj.ej2Instances.editModule.showDialog('EditOperationAlert', this.$refs.gridObj.ej2Instances.editModule.alertDObj)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'))
|
|
||||||
this.rowData = rowObj.data
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
}
|
|
||||||
},
|
|
||||||
editBtnClick: function (args) {
|
|
||||||
this.isEditing = true
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
if (args.type === 'actionBegin') {
|
|
||||||
this.rowData = args.rowData
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var target = args.target
|
|
||||||
if (target.classList.contains('e-edit')) {
|
|
||||||
target = target.parentElement
|
|
||||||
}
|
|
||||||
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'))
|
|
||||||
this.rowData = rowObj.data
|
|
||||||
},
|
|
||||||
onDlgClose () {
|
|
||||||
this.dlgShow = false
|
|
||||||
},
|
|
||||||
showTooltip: function (args) {
|
|
||||||
this.tooltip = new Tooltip({
|
|
||||||
beforeOpen: (e) => {
|
|
||||||
if (e.target.classList.contains('e-unboundcell') || e.target.lastChild.classList.contains('e-unboundcell')) {
|
|
||||||
// e.cancel = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
content: args.data['Note'].toString() }, args.row)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
provide: {
|
|
||||||
grid: [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
AddHardware
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="row top-row">
|
<div class="row top-row">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Issued Licenses</h3></div>
|
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Issued Licenses</h3></div>
|
||||||
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
|
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
|
||||||
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click.native="AddBtnClick"> <span class="e-add-icon"></span> Issue License</ejs-button>
|
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click="AddBtnClick"> <span class="e-add-icon"></span> Issue License</ejs-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
|
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
|
||||||
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
|
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
|
||||||
|
@ -32,110 +32,91 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { ref, provide } from 'vue';
|
||||||
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
|
import { GridComponent as EjsGrid, ColumnsDirective as EColumns, ColumnDirective as EColumn,
|
||||||
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
|
Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids';
|
||||||
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
|
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
|
||||||
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
|
import { DateRangePickerComponent as EjsDaterangepicker } from '@syncfusion/ej2-vue-calendars';
|
||||||
import IssueLicense from '@/components/IssueLicense'
|
import IssueLicense from '@/components/IssueLicense';
|
||||||
import { licenseData } from '../datasource.js'
|
import { licenseData } from '../datasource.js';
|
||||||
import { Browser } from '@syncfusion/ej2-base'
|
import { Browser } from '@syncfusion/ej2-base';
|
||||||
|
|
||||||
Vue.use(DateRangePickerPlugin)
|
const gridObj = ref(null);
|
||||||
Vue.use(GridPlugin)
|
const dlgShow = ref(false);
|
||||||
Vue.component(DropDownListComponent)
|
const isEditing = ref(false);
|
||||||
Vue.use(DatePickerPlugin)
|
const rowData = ref(null);
|
||||||
Vue.use(ButtonPlugin)
|
const waterMark = 'Select a range';
|
||||||
|
const gridData = licenseData;
|
||||||
|
const editSettings = { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' };
|
||||||
|
let toolbar = undefined;
|
||||||
|
const pageSettings = { pageCount: 5, pageSize: 10 };
|
||||||
|
let filterSettings = { type: 'Menu', columns: [] };
|
||||||
|
const filter = { type: 'CheckBox' };
|
||||||
|
const selectionSettings = { persistSelection: true };
|
||||||
|
const commands = [{ type: 'edit', buttonOption: { iconCss: 'e-icons e-edit', cssClass: 'e-flat e-noback', click: editBtnClick } },
|
||||||
|
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }];
|
||||||
|
|
||||||
export default Vue.extend({
|
function onGridLoad() {
|
||||||
data: function () {
|
if (Browser.isDevice) {
|
||||||
return {
|
toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete'];
|
||||||
dlgShow: false,
|
gridObj.value.ej2Instances.columns[7].visible = false;
|
||||||
isEditing: false,
|
|
||||||
rowData: null,
|
|
||||||
waterMark: 'Select a range',
|
|
||||||
gridData: licenseData,
|
|
||||||
editSettings: { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' },
|
|
||||||
toolbar: undefined,
|
|
||||||
editparams: { params: { popupHeight: '300px' } },
|
|
||||||
pageSettings: { pageCount: 5, pageSize: 10 },
|
|
||||||
filterSettings: { type: 'Menu', columns: [] },
|
|
||||||
filter: { type: 'CheckBox' },
|
|
||||||
selectionSettings: { persistSelection: true },
|
|
||||||
commands: [{ type: 'edit', buttonOption: { iconCss: 'e-icons e-edit', cssClass: 'e-flat e-noback', click: this.editBtnClick } },
|
|
||||||
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
onGridLoad: function () {
|
|
||||||
if (Browser.isDevice) {
|
|
||||||
this.toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete']
|
|
||||||
this.$refs.gridObj.ej2Instances.columns[7].visible = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onload: function () {
|
|
||||||
},
|
|
||||||
onActionBegin: function (args) {
|
|
||||||
if (args.requestType === 'beginEdit') {
|
|
||||||
this.editBtnClick(args)
|
|
||||||
args.cancel = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dateRangeChanged: function (args) {
|
|
||||||
// check wheather the value is empty or not
|
|
||||||
if (args.startDate && args.endDate) {
|
|
||||||
var filter = [
|
|
||||||
{ field: 'IssuedOn', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
|
|
||||||
{ field: 'IssuedOn', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
|
|
||||||
]
|
|
||||||
this.filterSettings = {type: 'Menu', columns: filter}
|
|
||||||
} else {
|
|
||||||
this.filterSettings = {type: 'Menu', columns: []}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
AddBtnClick: function () {
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
this.isEditing = false
|
|
||||||
},
|
|
||||||
editToolClicked: function (args) {
|
|
||||||
if (args.item.id === 'editTool') {
|
|
||||||
this.isEditing = true
|
|
||||||
var rows = this.$refs.gridObj.ej2Instances.getSelectedRows()[0]
|
|
||||||
if (!rows) {
|
|
||||||
this.$refs.gridObj.ej2Instances.editModule.showDialog('EditOperationAlert', this.$refs.gridObj.ej2Instances.editModule.alertDObj)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'))
|
|
||||||
this.rowData = rowObj.data
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
}
|
|
||||||
},
|
|
||||||
editBtnClick: function (args) {
|
|
||||||
this.isEditing = true
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
if (args.type === 'actionBegin') {
|
|
||||||
this.rowData = args.rowData
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var target = args.target
|
|
||||||
if (target.classList.contains('e-edit')) {
|
|
||||||
target = target.parentElement
|
|
||||||
}
|
|
||||||
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'))
|
|
||||||
this.rowData = rowObj.data
|
|
||||||
},
|
|
||||||
onDlgClose () {
|
|
||||||
this.dlgShow = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
provide: {
|
|
||||||
grid: [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
IssueLicense
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
function onActionBegin(args) {
|
||||||
|
if (args.requestType === 'beginEdit') {
|
||||||
|
editBtnClick(args);
|
||||||
|
args.cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function dateRangeChanged(args) {
|
||||||
|
// check wheather the value is empty or not
|
||||||
|
if (args.startDate && args.endDate) {
|
||||||
|
var filter = [
|
||||||
|
{ field: 'IssuedOn', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
|
||||||
|
{ field: 'IssuedOn', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
|
||||||
|
];
|
||||||
|
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: filter };
|
||||||
|
} else {
|
||||||
|
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: [] };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function AddBtnClick() {
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
isEditing.value = false;
|
||||||
|
}
|
||||||
|
function editToolClicked(args) {
|
||||||
|
if (args.item.id === 'editTool') {
|
||||||
|
isEditing.value = true;
|
||||||
|
var rows = gridObj.value.ej2Instances.getSelectedRows()[0];
|
||||||
|
if (!rows) {
|
||||||
|
gridObj.value.ej2Instances.editModule.showDialog('EditOperationAlert', gridObj.value.ej2Instances.editModule.alertDObj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'));
|
||||||
|
rowData.value = rowObj.data;
|
||||||
|
dlgShow.value = !this.dlgShow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editBtnClick(args) {
|
||||||
|
isEditing.value = true;
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
if (args.type === 'actionBegin') {
|
||||||
|
rowData.value = args.rowData;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var target = args.target;
|
||||||
|
if (target.classList.contains('e-edit')) {
|
||||||
|
target = target.parentElement;
|
||||||
|
}
|
||||||
|
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'));
|
||||||
|
rowData.value = rowObj.data;
|
||||||
|
}
|
||||||
|
function onDlgClose () {
|
||||||
|
dlgShow.value = false;
|
||||||
|
}
|
||||||
|
provide('grid', [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="row top-row">
|
<div class="row top-row">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Request</h3></div>
|
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Request</h3></div>
|
||||||
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
|
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
|
||||||
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click.native="AddBtnClick"> <span class="e-add-icon"></span> Create Request</ejs-button>
|
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click="AddBtnClick"> <span class="e-add-icon"></span> Create Request</ejs-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
|
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
|
||||||
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
|
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
|
||||||
|
@ -16,17 +16,17 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
|
||||||
<ejs-grid class="r-space" ref="gridObj" :rowDataBound="setStyle" :load="onGridLoad" :actionBegin='onActionBegin' :toolbarClick="editToolClicked" :toolbar="toolbar" :actionComplete='onload' :dataSource='gridData' :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
|
<ejs-grid class="r-space" ref="gridObj" :rowDataBound="setStyle" :load="onGridLoad" :actionBegin='onActionBegin' :toolbarClick="editToolClicked" :toolbar="toolbar" :dataSource='gridData' :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
|
||||||
<e-columns>
|
<e-columns>
|
||||||
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=60 :isPrimaryKey='true'></e-column>
|
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=80 :isPrimaryKey='true'></e-column>
|
||||||
<e-column field='Employee' headerText='Employee' clipMode='EllipsisWithTooltip' width=120></e-column>
|
<e-column field='Employee' headerText='Employee' clipMode='EllipsisWithTooltip' width=120></e-column>
|
||||||
<e-column field='RequestType' headerText='Request Type' :filter='filter' width=90></e-column>
|
<e-column field='RequestType' headerText='Request Type' :filter='filter' width=90></e-column>
|
||||||
<e-column field='RequestedItem' headerText='Requested Item' :filter='filter' clipMode='EllipsisWithTooltip' width=120></e-column>
|
<e-column field='RequestedItem' headerText='Requested Item' :filter='filter' clipMode='EllipsisWithTooltip' width=120></e-column>
|
||||||
<e-column field='RequestedOn' headerText='RequestedOn' textAlign='Right' type='date' editType='datepickeredit' format='yMd' width=90></e-column>
|
<e-column field='RequestedOn' headerText='RequestedOn' textAlign='Right' type='date' editType='datepickeredit' format='yMd' width=90></e-column>
|
||||||
<e-column field='Priority' headerText='Priority' :filter='filter' width=70></e-column>
|
<e-column field='Priority' headerText='Priority' :filter='filter' width=80></e-column>
|
||||||
<e-column field='Status' headerText='Status' width=70 :visible='false'></e-column>
|
<e-column field='Status' headerText='Status' width=70 :visible='false'></e-column>
|
||||||
<e-column field='Note' headerText='Notes' :visible='false'></e-column>
|
<e-column field='Note' headerText='Notes' :visible='false'></e-column>
|
||||||
<e-column headerText='' width='60' :commands='commands' textAlign='left'></e-column>
|
<e-column headerText='' width='70' :commands='commands' textAlign='left'></e-column>
|
||||||
<e-column headerText='' width='150' :commands='labelCommands' textAlign='left' ></e-column>
|
<e-column headerText='' width='150' :commands='labelCommands' textAlign='left' ></e-column>
|
||||||
</e-columns>
|
</e-columns>
|
||||||
</ejs-grid>
|
</ejs-grid>
|
||||||
|
@ -34,198 +34,179 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { ref, provide, getCurrentInstance } from 'vue';
|
||||||
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
|
import { GridComponent as EjsGrid, ColumnsDirective as EColumns, ColumnDirective as EColumn,
|
||||||
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
|
Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids';
|
||||||
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
|
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
|
||||||
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
|
import { DateRangePickerComponent as EjsDaterangepicker } from '@syncfusion/ej2-vue-calendars';
|
||||||
import RequestForm from '@/components/RequestForm'
|
import RequestForm from '@/components/RequestForm';
|
||||||
import { requestData, employeeData } from '../datasource.js'
|
import { requestData, employeeData } from '../datasource.js';
|
||||||
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
|
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
|
||||||
import { Browser } from '@syncfusion/ej2-base'
|
import { Browser } from '@syncfusion/ej2-base';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
Vue.use(DateRangePickerPlugin)
|
const store = useStore();
|
||||||
Vue.use(GridPlugin)
|
const root = getCurrentInstance();
|
||||||
Vue.component(DropDownListComponent)
|
const gridObj = ref(null);
|
||||||
Vue.use(DatePickerPlugin)
|
const dlgShow = ref(false);
|
||||||
Vue.use(ButtonPlugin)
|
const isEditing = ref(false);
|
||||||
|
const rowData = ref(null);
|
||||||
|
const waterMark = 'Select a range';
|
||||||
|
const gridData = requestData;
|
||||||
|
const editSettings = { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' };
|
||||||
|
let toolbar = undefined;
|
||||||
|
const pageSettings = { pageCount: 5, pageSize: 10 };
|
||||||
|
let filterSettings = { type: 'Menu', columns: [] };
|
||||||
|
const filter = { type: 'CheckBox' };
|
||||||
|
const selectionSettings = { persistSelection: true };
|
||||||
|
const commands = [{ type: 'edit', buttonOption: { iconCss: ' e-icons e-edit', cssClass: 'e-flat e-noback', click: editBtnClick } },
|
||||||
|
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }];
|
||||||
|
const labelCommands= [{ buttonOption: { content: 'Approve', iconCss: '', cssClass: 'e-flat e-approve', click: approveClick } },
|
||||||
|
{ buttonOption: { content: 'Reject', iconCss: '', cssClass: 'e-flat e-reject', click: rejectClick } }];
|
||||||
|
|
||||||
export default Vue.extend({
|
function onGridLoad() {
|
||||||
data: function () {
|
if (Browser.isDevice) {
|
||||||
return {
|
toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete'];
|
||||||
dlgShow: false,
|
gridObj.value.ej2Instances.columns[8].visible = false;
|
||||||
isEditing: false,
|
|
||||||
rowData: null,
|
|
||||||
waterMark: 'Select a range',
|
|
||||||
gridData: requestData,
|
|
||||||
editSettings: { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' },
|
|
||||||
toolbar: undefined,
|
|
||||||
editparams: { params: { popupHeight: '300px' } },
|
|
||||||
pageSettings: { pageCount: 5, pageSize: 10 },
|
|
||||||
filterSettings: { type: 'Menu', columns: [] },
|
|
||||||
filter: { type: 'CheckBox' },
|
|
||||||
selectionSettings: { persistSelection: true },
|
|
||||||
commands: [{ type: 'edit', buttonOption: { iconCss: ' e-icons e-edit', cssClass: 'e-flat e-noback', click: this.editBtnClick } },
|
|
||||||
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }],
|
|
||||||
labelCommands: [{ buttonOption: { content: 'Approve', iconCss: '', cssClass: 'e-flat e-approve', click: this.approveClick } },
|
|
||||||
{ buttonOption: { content: 'Reject', iconCss: '', cssClass: 'e-flat e-reject', click: this.rejectClick } }]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
onGridLoad: function () {
|
|
||||||
if (Browser.isDevice) {
|
|
||||||
this.toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete']
|
|
||||||
this.$refs.gridObj.ej2Instances.columns[8].visible = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onload: function () {
|
|
||||||
},
|
|
||||||
onActionBegin: function (args) {
|
|
||||||
if (args.requestType === 'beginEdit') {
|
|
||||||
this.editBtnClick(args)
|
|
||||||
args.cancel = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dateRangeChanged: function (args) {
|
|
||||||
// check wheather the value is empty or not
|
|
||||||
if (args.startDate && args.endDate) {
|
|
||||||
var filter = [
|
|
||||||
{ field: 'RequestedOn', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
|
|
||||||
{ field: 'RequestedOn', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
|
|
||||||
]
|
|
||||||
this.filterSettings = {type: 'Menu', columns: filter}
|
|
||||||
} else {
|
|
||||||
this.filterSettings = {type: 'Menu', columns: []}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
AddBtnClick: function () {
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
this.isEditing = false
|
|
||||||
// this.$refs.dialogObj.show()
|
|
||||||
},
|
|
||||||
editToolClicked: function (args) {
|
|
||||||
if (args.item.id === 'editTool') {
|
|
||||||
this.isEditing = true
|
|
||||||
var rows = this.$refs.gridObj.ej2Instances.getSelectedRows()[0]
|
|
||||||
if (!rows) {
|
|
||||||
this.$refs.gridObj.ej2Instances.editModule.showDialog('EditOperationAlert', this.$refs.gridObj.ej2Instances.editModule.alertDObj)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'))
|
|
||||||
this.rowData = rowObj.data
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
}
|
|
||||||
},
|
|
||||||
editBtnClick: function (args) {
|
|
||||||
this.isEditing = true
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
if (args.type === 'actionBegin') {
|
|
||||||
this.rowData = args.rowData
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var target = args.target
|
|
||||||
if (target.classList.contains('e-edit')) {
|
|
||||||
target = target.parentElement
|
|
||||||
}
|
|
||||||
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'))
|
|
||||||
this.rowData = rowObj.data
|
|
||||||
},
|
|
||||||
setStyle: function (args) {
|
|
||||||
var status = args.data['Status'].toString()
|
|
||||||
if (status === 'Approved') {
|
|
||||||
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-reject')
|
|
||||||
args.row.querySelectorAll('.e-unboundcell')[1].classList.add('row-approve')
|
|
||||||
args.row.querySelector('.e-approve').classList.add('e-hide')
|
|
||||||
args.row.querySelector('.e-reject').classList.add('e-hide')
|
|
||||||
} else if (status === 'Rejected') {
|
|
||||||
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-approve')
|
|
||||||
args.row.querySelectorAll('.e-unboundcell')[1].classList.add('row-reject')
|
|
||||||
args.row.querySelector('.e-approve').classList.add('e-hide')
|
|
||||||
args.row.querySelector('.e-reject').classList.add('e-hide')
|
|
||||||
} else {
|
|
||||||
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-approve')
|
|
||||||
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-reject')
|
|
||||||
args.row.querySelector('.e-approve').classList.remove('e-hide')
|
|
||||||
args.row.querySelector('.e-reject').classList.remove('e-hide')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onDlgClose () {
|
|
||||||
this.dlgShow = false
|
|
||||||
},
|
|
||||||
approveClick: function (args) {
|
|
||||||
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
|
|
||||||
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
|
|
||||||
var target = args.target
|
|
||||||
if (target.classList.contains('e-approve')) {
|
|
||||||
target = target.parentElement
|
|
||||||
}
|
|
||||||
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.getAttribute('data-uid'))
|
|
||||||
var row = rowObj.data
|
|
||||||
|
|
||||||
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
|
|
||||||
var index = parseInt(args.target.closest('td').getAttribute('index'))
|
|
||||||
grid.editModule.updateRow(index, {'TaskID': row['TaskID'], 'Status': 'Approved'})
|
|
||||||
|
|
||||||
var activity = {
|
|
||||||
'id': this.$store.state.activityData.length,
|
|
||||||
'Employee': userName,
|
|
||||||
'ImgSrc': userImg,
|
|
||||||
'TimeStamp': new Date().toLocaleDateString(),
|
|
||||||
'Message': 'A new request for ' + row['RequestedItem'] + ' has been approved'
|
|
||||||
}
|
|
||||||
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
|
||||||
this.$root.$children[0].$refs.toastRef.show({
|
|
||||||
title: 'Successs!',
|
|
||||||
content: 'Request approved successfully',
|
|
||||||
cssClass: 'e-toast-success',
|
|
||||||
icon: 'e-success toast-icons'
|
|
||||||
})
|
|
||||||
}).catch((reason) => {
|
|
||||||
alert(reason)
|
|
||||||
})
|
|
||||||
this.$root.$children[0].updatePendingRequests()
|
|
||||||
},
|
|
||||||
rejectClick: function (args) {
|
|
||||||
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
|
|
||||||
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
|
|
||||||
var target = args.target
|
|
||||||
if (target.classList.contains('e-reject')) {
|
|
||||||
target = target.parentElement
|
|
||||||
}
|
|
||||||
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.getAttribute('data-uid'))
|
|
||||||
var row = rowObj.data
|
|
||||||
|
|
||||||
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
|
|
||||||
var index = grid.selectedRowIndex
|
|
||||||
grid.editModule.updateRow(index, {'TaskID': row['TaskID'], 'Status': 'Rejected'})
|
|
||||||
var activity = {
|
|
||||||
'id': this.$store.state.activityData.length,
|
|
||||||
'Employee': userName,
|
|
||||||
'ImgSrc': userImg,
|
|
||||||
'TimeStamp': new Date().toLocaleDateString(),
|
|
||||||
'Message': 'A new request for ' + row['RequestedItem'] + ' has been rejected'
|
|
||||||
}
|
|
||||||
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
|
||||||
this.$root.$children[0].$refs.toastRef.show({
|
|
||||||
title: 'Successs!',
|
|
||||||
content: 'Request rejected successfully',
|
|
||||||
cssClass: 'e-toast-success',
|
|
||||||
icon: 'e-success toast-icons'
|
|
||||||
})
|
|
||||||
}).catch((reason) => {
|
|
||||||
alert(reason)
|
|
||||||
})
|
|
||||||
this.$root.$children[0].updatePendingRequests()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
provide: {
|
|
||||||
grid: [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
RequestForm
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
function onActionBegin(args) {
|
||||||
|
if (args.requestType === 'beginEdit') {
|
||||||
|
editBtnClick(args);
|
||||||
|
args.cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function dateRangeChanged(args) {
|
||||||
|
// check wheather the value is empty or not
|
||||||
|
if (args.startDate && args.endDate) {
|
||||||
|
var filter = [
|
||||||
|
{ field: 'RequestedOn', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
|
||||||
|
{ field: 'RequestedOn', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
|
||||||
|
];
|
||||||
|
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: filter };
|
||||||
|
} else {
|
||||||
|
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: [] };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function AddBtnClick() {
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
isEditing.value = false;
|
||||||
|
// dialogObj.value.show();
|
||||||
|
}
|
||||||
|
function editToolClicked(args) {
|
||||||
|
if (args.item.id === 'editTool') {
|
||||||
|
isEditing.value = true;
|
||||||
|
var rows = gridObj.value.ej2Instances.getSelectedRows()[0];
|
||||||
|
if (!rows) {
|
||||||
|
gridObj.value.ej2Instances.editModule.showDialog('EditOperationAlert', gridObj.value.ej2Instances.editModule.alertDObj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'));
|
||||||
|
rowData.value = rowObj.data;
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editBtnClick(args) {
|
||||||
|
isEditing.value = true;
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
if (args.type === 'actionBegin') {
|
||||||
|
rowData.value = args.rowData;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var target = args.target;
|
||||||
|
if (target.classList.contains('e-edit')) {
|
||||||
|
target = target.parentElement;
|
||||||
|
}
|
||||||
|
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'));
|
||||||
|
rowData.value = rowObj.data;
|
||||||
|
}
|
||||||
|
function setStyle(args) {
|
||||||
|
var status = args.data['Status'].toString();
|
||||||
|
if (status === 'Approved') {
|
||||||
|
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-reject');
|
||||||
|
args.row.querySelectorAll('.e-unboundcell')[1].classList.add('row-approve');
|
||||||
|
args.row.querySelector('.e-approve').classList.add('e-hide');
|
||||||
|
args.row.querySelector('.e-reject').classList.add('e-hide');
|
||||||
|
} else if (status === 'Rejected') {
|
||||||
|
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-approve');
|
||||||
|
args.row.querySelectorAll('.e-unboundcell')[1].classList.add('row-reject');
|
||||||
|
args.row.querySelector('.e-approve').classList.add('e-hide');
|
||||||
|
args.row.querySelector('.e-reject').classList.add('e-hide');
|
||||||
|
} else {
|
||||||
|
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-approve');
|
||||||
|
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-reject');
|
||||||
|
args.row.querySelector('.e-approve').classList.remove('e-hide');
|
||||||
|
args.row.querySelector('.e-reject').classList.remove('e-hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onDlgClose () {
|
||||||
|
dlgShow.value = false;
|
||||||
|
}
|
||||||
|
function approveClick(args) {
|
||||||
|
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
|
||||||
|
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
|
||||||
|
var target = args.target;
|
||||||
|
if (target.classList.contains('e-approve')) {
|
||||||
|
target = target.parentElement;
|
||||||
|
}
|
||||||
|
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.getAttribute('data-uid'));
|
||||||
|
var row = rowObj.data;
|
||||||
|
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
|
||||||
|
var index = parseInt(args.target.closest('td').getAttribute('index'));
|
||||||
|
grid.editModule.updateRow(index, {'TaskID': row['TaskID'], 'Status': 'Approved'});
|
||||||
|
var activity = {
|
||||||
|
'id': store.state.activityData.length,
|
||||||
|
'Employee': userName,
|
||||||
|
'ImgSrc': userImg,
|
||||||
|
'TimeStamp': new Date().toLocaleDateString(),
|
||||||
|
'Message': 'A new request for ' + row['RequestedItem'] + ' has been approved'
|
||||||
|
};
|
||||||
|
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
||||||
|
root.root.refs.toastRef.show({
|
||||||
|
title: 'Successs!',
|
||||||
|
content: 'Request approved successfully',
|
||||||
|
cssClass: 'e-toast-success',
|
||||||
|
icon: 'e-success toast-icons'
|
||||||
|
});
|
||||||
|
}).catch((reason) => {
|
||||||
|
alert(reason);
|
||||||
|
});
|
||||||
|
root.root.devtoolsRawSetupState.updatePendingRequests();
|
||||||
|
}
|
||||||
|
function rejectClick(args) {
|
||||||
|
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
|
||||||
|
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
|
||||||
|
var target = args.target;
|
||||||
|
if (target.classList.contains('e-reject')) {
|
||||||
|
target = target.parentElement;
|
||||||
|
}
|
||||||
|
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.getAttribute('data-uid'));
|
||||||
|
var row = rowObj.data;
|
||||||
|
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
|
||||||
|
var index = parseInt(args.target.closest('td').getAttribute('index'));
|
||||||
|
grid.editModule.updateRow(index, {'TaskID': row['TaskID'], 'Status': 'Rejected'});
|
||||||
|
var activity = {
|
||||||
|
'id': store.state.activityData.length,
|
||||||
|
'Employee': userName,
|
||||||
|
'ImgSrc': userImg,
|
||||||
|
'TimeStamp': new Date().toLocaleDateString(),
|
||||||
|
'Message': 'A new request for ' + row['RequestedItem'] + ' has been rejected'
|
||||||
|
};
|
||||||
|
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
||||||
|
root.root.refs.toastRef.show({
|
||||||
|
title: 'Successs!',
|
||||||
|
content: 'Request rejected successfully',
|
||||||
|
cssClass: 'e-toast-success',
|
||||||
|
icon: 'e-success toast-icons'
|
||||||
|
});
|
||||||
|
}).catch((reason) => {
|
||||||
|
alert(reason);
|
||||||
|
});
|
||||||
|
root.root.devtoolsRawSetupState.updatePendingRequests();
|
||||||
|
}
|
||||||
|
provide('grid', [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="row top-row">
|
<div class="row top-row">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Software</h3></div>
|
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Software</h3></div>
|
||||||
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
|
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
|
||||||
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click.native="AddBtnClick"> <span class="e-add-icon"></span> Add New Software</ejs-button>
|
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click="AddBtnClick"> <span class="e-add-icon"></span> Add New Software</ejs-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
|
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
|
||||||
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
|
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
|
||||||
<ejs-grid class="r-space" ref="gridObj" :dataSource='gridData' :load="onGridLoad" :actionBegin='onActionBegin' :toolbarClick="editToolClicked" :toolbar="toolbar" :actionComplete='onload' :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
|
<ejs-grid class="r-space" ref="gridObj" :dataSource='gridData' :load="onGridLoad" :actionBegin='onActionBegin' :toolbarClick="editToolClicked" :toolbar="toolbar" :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
|
||||||
<e-columns>
|
<e-columns>
|
||||||
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=90 :isPrimaryKey='true'></e-column>
|
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=90 :isPrimaryKey='true'></e-column>
|
||||||
<e-column field='Name' headerText='Software Name' :filter='filter' clipMode='EllipsisWithTooltip' width=120></e-column>
|
<e-column field='Name' headerText='Software Name' :filter='filter' clipMode='EllipsisWithTooltip' width=120></e-column>
|
||||||
|
@ -36,110 +36,91 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { ref, provide } from 'vue';
|
||||||
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
|
import { GridComponent as EjsGrid, ColumnsDirective as EColumns, ColumnDirective as EColumn,
|
||||||
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
|
Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids';
|
||||||
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
|
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
|
||||||
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
|
import { DateRangePickerComponent as EjsDaterangepicker } from '@syncfusion/ej2-vue-calendars';
|
||||||
import AddSoftware from '@/components/AddSoftware'
|
import AddSoftware from '@/components/AddSoftware';
|
||||||
import { softwareData } from '../datasource.js'
|
import { softwareData } from '../datasource.js';
|
||||||
import { Browser } from '@syncfusion/ej2-base'
|
import { Browser } from '@syncfusion/ej2-base';
|
||||||
|
|
||||||
Vue.use(DateRangePickerPlugin)
|
const gridObj = ref(null);
|
||||||
Vue.use(GridPlugin)
|
const dlgShow = ref(false);
|
||||||
Vue.component(DropDownListComponent)
|
const isEditing = ref(false);
|
||||||
Vue.use(DatePickerPlugin)
|
const rowData = ref(null);
|
||||||
Vue.use(ButtonPlugin)
|
const waterMark = 'Select a range';
|
||||||
|
const gridData = softwareData;
|
||||||
|
const editSettings = { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' };
|
||||||
|
let toolbar = undefined;
|
||||||
|
const pageSettings= { pageCount: 5, pageSize: 10 };
|
||||||
|
let filterSettings = { type: 'Menu', columns: [] };
|
||||||
|
const filter= { type: 'CheckBox' };
|
||||||
|
const selectionSettings= { persistSelection: true };
|
||||||
|
const commands= [{ type: 'edit', buttonOption: { iconCss: ' e-icons e-edit', cssClass: 'e-flat e-noback', click: editBtnClick } },
|
||||||
|
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }];
|
||||||
|
|
||||||
export default Vue.extend({
|
function onGridLoad() {
|
||||||
data: function () {
|
if (Browser.isDevice) {
|
||||||
return {
|
toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete'];
|
||||||
dlgShow: false,
|
gridObj.value.ej2Instances.columns[11].visible = false;
|
||||||
isEditing: false,
|
|
||||||
rowData: null,
|
|
||||||
waterMark: 'Select a range',
|
|
||||||
gridData: softwareData,
|
|
||||||
editSettings: { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' },
|
|
||||||
toolbar: undefined,
|
|
||||||
editparams: { params: { popupHeight: '300px' } },
|
|
||||||
pageSettings: { pageCount: 5, pageSize: 10 },
|
|
||||||
filterSettings: { type: 'Menu', columns: [] },
|
|
||||||
filter: { type: 'CheckBox' },
|
|
||||||
selectionSettings: { persistSelection: true },
|
|
||||||
commands: [{ type: 'edit', buttonOption: { iconCss: ' e-icons e-edit', cssClass: 'e-flat e-noback', click: this.editBtnClick } },
|
|
||||||
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
onGridLoad: function () {
|
|
||||||
if (Browser.isDevice) {
|
|
||||||
this.toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete']
|
|
||||||
this.$refs.gridObj.ej2Instances.columns[11].visible = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onload: function () {
|
|
||||||
},
|
|
||||||
onActionBegin: function (args) {
|
|
||||||
if (args.requestType === 'beginEdit') {
|
|
||||||
this.editBtnClick(args)
|
|
||||||
args.cancel = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dateRangeChanged: function (args) {
|
|
||||||
// check wheather the value is empty or not
|
|
||||||
if (args.startDate && args.endDate) {
|
|
||||||
var filter = [
|
|
||||||
{ field: 'DOP', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
|
|
||||||
{ field: 'DOP', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
|
|
||||||
]
|
|
||||||
this.filterSettings = {type: 'Menu', columns: filter}
|
|
||||||
} else {
|
|
||||||
this.filterSettings = {type: 'Menu', columns: []}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
AddBtnClick: function () {
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
this.isEditing = false
|
|
||||||
},
|
|
||||||
editToolClicked: function (args) {
|
|
||||||
if (args.item.id === 'editTool') {
|
|
||||||
this.isEditing = true
|
|
||||||
var rows = this.$refs.gridObj.ej2Instances.getSelectedRows()[0]
|
|
||||||
if (!rows) {
|
|
||||||
this.$refs.gridObj.ej2Instances.editModule.showDialog('EditOperationAlert', this.$refs.gridObj.ej2Instances.editModule.alertDObj)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'))
|
|
||||||
this.rowData = rowObj.data
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
}
|
|
||||||
},
|
|
||||||
editBtnClick: function (args) {
|
|
||||||
this.isEditing = true
|
|
||||||
this.dlgShow = !this.dlgShow
|
|
||||||
if (args.type === 'actionBegin') {
|
|
||||||
this.rowData = args.rowData
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var target = args.target
|
|
||||||
if (target.classList.contains('e-edit')) {
|
|
||||||
target = target.parentElement
|
|
||||||
}
|
|
||||||
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'))
|
|
||||||
this.rowData = rowObj.data
|
|
||||||
},
|
|
||||||
onDlgClose () {
|
|
||||||
this.dlgShow = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
provide: {
|
|
||||||
grid: [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
AddSoftware
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
function onActionBegin(args) {
|
||||||
|
if (args.requestType === 'beginEdit') {
|
||||||
|
editBtnClick(args);
|
||||||
|
args.cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function dateRangeChanged (args) {
|
||||||
|
// check wheather the value is empty or not
|
||||||
|
if (args.startDate && args.endDate) {
|
||||||
|
var filter = [
|
||||||
|
{ field: 'DOP', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
|
||||||
|
{ field: 'DOP', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
|
||||||
|
];
|
||||||
|
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: filter };
|
||||||
|
} else {
|
||||||
|
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: [] };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function AddBtnClick () {
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
isEditing.value = false;
|
||||||
|
}
|
||||||
|
function editToolClicked(args) {
|
||||||
|
if (args.item.id === 'editTool') {
|
||||||
|
isEditing.value = true;
|
||||||
|
var rows = gridObj.value.ej2Instances.getSelectedRows()[0];
|
||||||
|
if (!rows) {
|
||||||
|
gridObj.value.ej2Instances.editModule.showDialog('EditOperationAlert', gridObj.value.ej2Instances.editModule.alertDObj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let rowObj =gridObj.value.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'));
|
||||||
|
rowData.value = rowObj.data;
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editBtnClick(args) {
|
||||||
|
isEditing.value = true;
|
||||||
|
dlgShow.value = !dlgShow.value;
|
||||||
|
if (args.type === 'actionBegin') {
|
||||||
|
rowData.value = args.rowData;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var target = args.target;
|
||||||
|
if (target.classList.contains('e-edit')) {
|
||||||
|
target = target.parentElement;
|
||||||
|
}
|
||||||
|
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'));
|
||||||
|
rowData.value = rowObj.data;
|
||||||
|
}
|
||||||
|
function onDlgClose () {
|
||||||
|
dlgShow.value = false;
|
||||||
|
}
|
||||||
|
provide('grid', [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div tabindex="0" class="e-card" id="card-request" @click="requestClick($event)">
|
<div tabindex="0" class="e-card" id="card-request" @click="requestClick($event)">
|
||||||
<div class="e-card-header">
|
<div class="e-card-header">
|
||||||
<div class="e-card-header-caption">
|
<div class="e-card-header-caption">
|
||||||
<div class="e-card-header-title">{{this.$store.getters.requests}}</div>
|
<div class="e-card-header-title">{{store.getters.requests}}</div>
|
||||||
<div class="e-card-sub-title">Requests Processed</div>
|
<div class="e-card-sub-title">Requests Processed</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<div tabindex="0" class="e-card" id="card-license" @click="licenseClick($event)">
|
<div tabindex="0" class="e-card" id="card-license" @click="licenseClick($event)">
|
||||||
<div class="e-card-header">
|
<div class="e-card-header">
|
||||||
<div class="e-card-header-caption">
|
<div class="e-card-header-caption">
|
||||||
<div class="e-card-header-title">{{this.$store.getters.licenses}}</div>
|
<div class="e-card-header-title">{{store.getters.licenses}}</div>
|
||||||
<div class="e-card-sub-title">Licenses Issued</div>
|
<div class="e-card-sub-title">Licenses Issued</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,55 +69,45 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4 list-surface">
|
<div class="col-lg-4 list-surface">
|
||||||
<div class="list-area">
|
<div class="list-area">
|
||||||
<ejs-listview id='listview_template' ref='list_template' :fields='fields' :dataSource='data' :showHeader='header' :headerTitle='listTitle' :actionComplete='onComplete' :template='ltemplate'></ejs-listview>
|
<ejs-listview id='listview_template' ref='list_template' :fields='fields' :dataSource='data' :showHeader='header' :headerTitle='listTitle' :template='ltemplate'></ejs-listview>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { ListViewComponent as EjsListview } from '@syncfusion/ej2-vue-lists';
|
||||||
import { ListViewPlugin } from '@syncfusion/ej2-vue-lists'
|
import ActivityTemplate from './ActivityTemplate.vue';
|
||||||
import ActivityTemplate from './ActivityTemplate.vue'
|
import SoftwareLicenseChart from '@/components/dashboard/SoftwareLicenseChart';
|
||||||
import SoftwareLicenseChart from '@/components/dashboard/SoftwareLicenseChart'
|
import HardwareStatusChart from '@/components/dashboard/HardwareStatusChart';
|
||||||
import HardwareStatusChart from '@/components/dashboard/HardwareStatusChart'
|
import HardwareCategoryChart from '@/components/dashboard/HardwareCategoryChart';
|
||||||
import HardwareCategoryChart from '@/components/dashboard/HardwareCategoryChart'
|
import SoftwareCategoryChart from '@/components/dashboard/SoftwareCategoryChart';
|
||||||
import SoftwareCategoryChart from '@/components/dashboard/SoftwareCategoryChart'
|
import { createApp } from "vue";
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const store = useStore();
|
||||||
|
const app = createApp();
|
||||||
|
|
||||||
|
const header = true;
|
||||||
|
const data = store.state.activityData;
|
||||||
|
const ltemplate = function () {
|
||||||
|
return { template: app.component("dashboardListTemplate", ActivityTemplate) };
|
||||||
|
};
|
||||||
|
const listTitle = 'Recent Activities';
|
||||||
|
const fields = { 'id': 'Employee' };
|
||||||
|
|
||||||
|
function requestClick() {
|
||||||
|
router.push({ path: '/Requests' });
|
||||||
|
// this.$root.$children[0].$refs.sidebarListObj.selectItem({id: '05'});
|
||||||
|
}
|
||||||
|
function licenseClick() {
|
||||||
|
router.push({ path: '/IssuedLicenses' });
|
||||||
|
// this.$root.$children[0].$refs.sidebarListObj.selectItem({id: '04'});
|
||||||
|
}
|
||||||
|
|
||||||
Vue.use(ListViewPlugin)
|
|
||||||
export default Vue.extend({
|
|
||||||
data: function () {
|
|
||||||
return {
|
|
||||||
header: true,
|
|
||||||
data: this.$store.state.activityData,
|
|
||||||
// eslint-disable-next-line
|
|
||||||
ltemplate: function () {
|
|
||||||
return {template: ActivityTemplate}
|
|
||||||
},
|
|
||||||
listTitle: 'Recent Activities',
|
|
||||||
fields: { 'id': 'Employee' }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
requestClick: function () {
|
|
||||||
this.$router.push({ path: '/Requests' })
|
|
||||||
this.$root.$children[0].$refs.sidebarListObj.selectItem({id: '05'})
|
|
||||||
},
|
|
||||||
licenseClick: function () {
|
|
||||||
this.$router.push({ path: '/IssuedLicenses' })
|
|
||||||
this.$root.$children[0].$refs.sidebarListObj.selectItem({id: '04'})
|
|
||||||
},
|
|
||||||
onComplete: function () {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
SoftwareLicenseChart,
|
|
||||||
HardwareStatusChart,
|
|
||||||
HardwareCategoryChart,
|
|
||||||
SoftwareCategoryChart
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -12,12 +12,12 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
|
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
|
||||||
<label class="e-text">Employee Name</label>
|
<label class="e-text">Employee Name</label>
|
||||||
<ejs-autocomplete id="employee" name="Emp" data-msg-containerid="errorEmp" v-model="value" v-bind:value="value" ref='employeeInstance' :dataSource='this.$store.getters.empData' :fields='fields'></ejs-autocomplete>
|
<ejs-autocomplete id="employee" name="Emp" data-msg-containerid="errorEmp" v-model="value" v-bind:value="value" ref='employeeInstance' :dataSource='store.getters.empData' :fields='fields'></ejs-autocomplete>
|
||||||
<div id="errorEmp"></div>
|
<div id="errorEmp"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
|
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
|
||||||
<label class="e-text">Software</label>
|
<label class="e-text">Software</label>
|
||||||
<ejs-dropdownlist id="software" name="Name" :dataSource ="this.$store.getters.softwareNames" :fields='softwareFields'></ejs-dropdownlist>
|
<ejs-dropdownlist id="software" name="Name" :dataSource ="store.getters.softwareNames" :fields='softwareFields'></ejs-dropdownlist>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
<div class="row pull-right">
|
<div class="row pull-right">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
|
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
|
||||||
<ejs-button id="primarybtn" :isPrimary="true" @click.native="addRecord">{{btnName}}</ejs-button>
|
<ejs-button id="primarybtn" :isPrimary="true" v-on:click="addRecord">{{btnName}}</ejs-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,170 +54,170 @@
|
||||||
</form>
|
</form>
|
||||||
</ejs-dialog>
|
</ejs-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { onMounted, computed, getCurrentInstance, ref } from 'vue';
|
||||||
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
|
import { DialogComponent as EjsDialog } from '@syncfusion/ej2-vue-popups';
|
||||||
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
|
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
|
||||||
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
|
import { DatePickerComponent as EjsDatepicker } from '@syncfusion/ej2-vue-calendars';
|
||||||
import { FormValidator } from '@syncfusion/ej2-vue-inputs'
|
import { DropDownListComponent as EjsDropdownlist, AutoCompleteComponent as EjsAutocomplete } from '@syncfusion/ej2-vue-dropdowns';
|
||||||
import { employeeData } from '../datasource.js'
|
import { FormValidator } from '@syncfusion/ej2-vue-inputs';
|
||||||
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
|
import { employeeData } from '../datasource.js';
|
||||||
|
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
Vue.component(DropDownListComponent)
|
const store = useStore();
|
||||||
Vue.use(DatePickerPlugin)
|
const root = getCurrentInstance();
|
||||||
Vue.use(ButtonPlugin)
|
const dialogObj = ref(null);
|
||||||
export default Vue.extend({
|
const employeeInstance = ref(null);
|
||||||
data: function () {
|
|
||||||
return {
|
const fields = {value: 'Employee'};
|
||||||
fields: {value: 'Employee'},
|
const softwareFields = { text: 'Name', value: 'TaskID' };
|
||||||
softwareFields: { text: 'Name', value: 'TaskID' },
|
let header = 'Issue License';
|
||||||
header: 'Issue License',
|
const target = document.body;
|
||||||
target: document.body,
|
const showCloseIcon = true;
|
||||||
showCloseIcon: true,
|
const width = '500px';
|
||||||
width: '500px',
|
let btnName = 'Submit';
|
||||||
btnName: 'Submit',
|
const isModal = true;
|
||||||
isModal: true,
|
const maxDate = new Date();
|
||||||
maxDate: new Date(),
|
const options = {
|
||||||
options: {
|
// Initialize the CustomPlacement.
|
||||||
// Initialize the CustomPlacement.
|
customPlacement: function (inputElement, errorElement) {
|
||||||
customPlacement: function (inputElement, errorElement) {
|
inputElement.parentElement.nextElementSibling.appendChild(errorElement);
|
||||||
inputElement.parentElement.nextElementSibling.appendChild(errorElement)
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
Emp: { required: true },
|
|
||||||
DOI: { required: true, date: true }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
frmObj: undefined,
|
|
||||||
value: null,
|
|
||||||
animationSettings: { effect: 'None' }
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted: function () {
|
rules: {
|
||||||
this.frmObj = new FormValidator('#formId', this.options)
|
Emp: { required: true },
|
||||||
},
|
DOI: { required: true, date: true }
|
||||||
methods: {
|
|
||||||
dialogClose: function () {
|
|
||||||
this.$emit('close')
|
|
||||||
},
|
|
||||||
dialogOpen: function () {
|
|
||||||
this.frmObj.reset()
|
|
||||||
if (!this.isEdit) {
|
|
||||||
this.header = 'Issue License'
|
|
||||||
this.btnName = 'Submit'
|
|
||||||
document.getElementById('employee').value = ''
|
|
||||||
document.getElementById('software').value = ''
|
|
||||||
document.getElementById('license-count').value = '0'
|
|
||||||
document.getElementById('license-key').value = ''
|
|
||||||
document.getElementById('issue-date').value = new Date().toLocaleDateString()
|
|
||||||
document.getElementById('note').value = ''
|
|
||||||
} else {
|
|
||||||
this.header = 'Edit Issued license'
|
|
||||||
this.btnName = 'Save'
|
|
||||||
var row = this.rowData
|
|
||||||
document.getElementById('taskID').value = row['TaskID']
|
|
||||||
this.$refs.employeeInstance.ej2Instances.value = row['Employee']
|
|
||||||
this.$refs.employeeInstance.ej2Instances.dataBind()
|
|
||||||
document.getElementById('software').value = row['Software']
|
|
||||||
document.getElementById('license-count').value = '10' // row['InvoiceNo']
|
|
||||||
document.getElementById('license-key').value = row['LicenseKey']
|
|
||||||
document.getElementById('issue-date').value = row['IssuedOn'].toLocaleDateString()
|
|
||||||
document.getElementById('note').value = row['Note']
|
|
||||||
}
|
|
||||||
this.$refs.dialogObj.show()
|
|
||||||
},
|
|
||||||
addRecord: function () {
|
|
||||||
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
|
|
||||||
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
|
|
||||||
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
|
|
||||||
if (this.frmObj.validate()) {
|
|
||||||
if (!this.isEdit) {
|
|
||||||
var id = this.$store.state.activityData.length
|
|
||||||
grid.addRecord({
|
|
||||||
'TaskID': grid.dataSource.length + 1,
|
|
||||||
'Employee': document.getElementById('employee').value,
|
|
||||||
'Email': 'paul.henriot@sample.com',
|
|
||||||
'Software': document.getElementById('software').value,
|
|
||||||
'LicenseKey': document.getElementById('license-key').value,
|
|
||||||
'IssuedOn': new Date(document.getElementById('issue-date').value),
|
|
||||||
'Note': document.getElementById('note').value
|
|
||||||
})
|
|
||||||
var activity = {
|
|
||||||
'id': id,
|
|
||||||
'Employee': userName,
|
|
||||||
'ImgSrc': userImg,
|
|
||||||
'TimeStamp': new Date().toLocaleDateString(),
|
|
||||||
'Message': 'A new License for software' + document.getElementById('software').value + ' has been issued'
|
|
||||||
}
|
|
||||||
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
|
||||||
this.$root.$children[0].$refs.toastRef.show({
|
|
||||||
title: 'Successs!',
|
|
||||||
content: 'License Issued successfully',
|
|
||||||
cssClass: 'e-toast-success',
|
|
||||||
icon: 'e-success toast-icons'
|
|
||||||
})
|
|
||||||
}).catch((reason) => {
|
|
||||||
alert(reason)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
var data = {'TaskID': +document.getElementById('taskID').value,
|
|
||||||
'Employee': document.getElementById('employee').value,
|
|
||||||
'Email': 'paul.henriot@sample.com',
|
|
||||||
'Software': document.getElementById('software').value,
|
|
||||||
'LicenseKey': document.getElementById('license-key').value,
|
|
||||||
'IssuedOn': new Date(document.getElementById('issue-date').value),
|
|
||||||
'Note': document.getElementById('note').value
|
|
||||||
}
|
|
||||||
var index = grid.selectedRowIndex
|
|
||||||
grid.editModule.updateRow(index, data)
|
|
||||||
activity = {
|
|
||||||
'id': id,
|
|
||||||
'Employee': userName,
|
|
||||||
'ImgSrc': userImg,
|
|
||||||
'TimeStamp': new Date().toLocaleDateString(),
|
|
||||||
'Message': 'The License for software ' + document.getElementById('software').value + ' has been edited'
|
|
||||||
}
|
|
||||||
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
|
||||||
this.$root.$children[0].$refs.toastRef.show({
|
|
||||||
title: 'Successs!',
|
|
||||||
content: 'License updated successfully',
|
|
||||||
cssClass: 'e-toast-success',
|
|
||||||
icon: 'e-success toast-icons'
|
|
||||||
})
|
|
||||||
}).catch((reason) => {
|
|
||||||
alert(reason)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.frmObj.reset()
|
|
||||||
this.$refs.dialogObj.hide()
|
|
||||||
this.$emit('close')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
/** Whether the dialog is currently showing */
|
|
||||||
showing: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
isEdit: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
rowData: {
|
|
||||||
type: Object,
|
|
||||||
required: false,
|
|
||||||
default: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShowing () {
|
|
||||||
return this.showing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
let frmObj = undefined;
|
||||||
|
const value = null;
|
||||||
|
const animationSettings = { effect: 'None' };
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
onMounted(() => {
|
||||||
|
frmObj = new FormValidator('#formId', options);
|
||||||
})
|
})
|
||||||
|
function dialogClose() {
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
function dialogOpen () {
|
||||||
|
frmObj.reset();
|
||||||
|
if (!props.isEdit) {
|
||||||
|
header = 'Issue License';
|
||||||
|
btnName = 'Submit';
|
||||||
|
document.getElementById('employee').value = '';
|
||||||
|
document.getElementById('software').value = '';
|
||||||
|
document.getElementById('license-count').value = '0';
|
||||||
|
document.getElementById('license-key').value = '';
|
||||||
|
document.getElementById('issue-date').value = new Date().toLocaleDateString();
|
||||||
|
document.getElementById('note').value = '';
|
||||||
|
} else {
|
||||||
|
header = 'Edit Issued license';
|
||||||
|
btnName = 'Save';
|
||||||
|
var row = props.rowData;
|
||||||
|
document.getElementById('taskID').value = row['TaskID'];
|
||||||
|
employeeInstance.value.ej2Instances.value = row['Employee'];
|
||||||
|
employeeInstance.value.ej2Instances.dataBind();
|
||||||
|
document.getElementById('software').value = row['Software'];
|
||||||
|
document.getElementById('license-count').value = '10' // row['InvoiceNo'];
|
||||||
|
document.getElementById('license-key').value = row['LicenseKey'];
|
||||||
|
document.getElementById('issue-date').value = row['IssuedOn'].toLocaleDateString();
|
||||||
|
document.getElementById('note').value = row['Note'];
|
||||||
|
}
|
||||||
|
dialogObj.value.show();
|
||||||
|
}
|
||||||
|
function addRecord() {
|
||||||
|
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
|
||||||
|
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
|
||||||
|
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
|
||||||
|
if (frmObj.validate()) {
|
||||||
|
if (!props.isEdit) {
|
||||||
|
var id = store.state.activityData.length;
|
||||||
|
grid.addRecord({
|
||||||
|
'TaskID': grid.dataSource.length + 1,
|
||||||
|
'Employee': document.getElementById('employee').value,
|
||||||
|
'Email': 'paul.henriot@sample.com',
|
||||||
|
'Software': document.getElementById('software').value,
|
||||||
|
'LicenseKey': document.getElementById('license-key').value,
|
||||||
|
'IssuedOn': new Date(document.getElementById('issue-date').value),
|
||||||
|
'Note': document.getElementById('note').value
|
||||||
|
});
|
||||||
|
var activity = {
|
||||||
|
'id': id,
|
||||||
|
'Employee': userName,
|
||||||
|
'ImgSrc': userImg,
|
||||||
|
'TimeStamp': new Date().toLocaleDateString(),
|
||||||
|
'Message': 'A new License for software' + document.getElementById('software').value + ' has been issued'
|
||||||
|
};
|
||||||
|
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
||||||
|
root.root.refs.toastRef.show({
|
||||||
|
title: 'Successs!',
|
||||||
|
content: 'License Issued successfully',
|
||||||
|
cssClass: 'e-toast-success',
|
||||||
|
icon: 'e-success toast-icons'
|
||||||
|
});
|
||||||
|
}).catch((reason) => {
|
||||||
|
alert(reason);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var data = {
|
||||||
|
'TaskID': +document.getElementById('taskID').value,
|
||||||
|
'Employee': document.getElementById('employee').value,
|
||||||
|
'Email': 'paul.henriot@sample.com',
|
||||||
|
'Software': document.getElementById('software').value,
|
||||||
|
'LicenseKey': document.getElementById('license-key').value,
|
||||||
|
'IssuedOn': new Date(document.getElementById('issue-date').value),
|
||||||
|
'Note': document.getElementById('note').value
|
||||||
|
};
|
||||||
|
var index = grid.selectedRowIndex;
|
||||||
|
grid.editModule.updateRow(index, data);
|
||||||
|
activity = {
|
||||||
|
'id': id,
|
||||||
|
'Employee': userName,
|
||||||
|
'ImgSrc': userImg,
|
||||||
|
'TimeStamp': new Date().toLocaleDateString(),
|
||||||
|
'Message': 'The License for software ' + document.getElementById('software').value + ' has been edited'
|
||||||
|
};
|
||||||
|
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
||||||
|
root.root.refs.toastRef.show({
|
||||||
|
title: 'Successs!',
|
||||||
|
content: 'License updated successfully',
|
||||||
|
cssClass: 'e-toast-success',
|
||||||
|
icon: 'e-success toast-icons'
|
||||||
|
});
|
||||||
|
}).catch((reason) => {
|
||||||
|
alert(reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
frmObj.reset();
|
||||||
|
dialogObj.value.hide();
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const emit = defineEmits(['close']);
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const props = defineProps({
|
||||||
|
/** Whether the dialog is currently showing */
|
||||||
|
showing: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
isEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
rowData: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const isShowing = computed(() => {
|
||||||
|
return props.showing;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -3,43 +3,45 @@
|
||||||
<ejs-listview id='listview_notification' :fields='fields' ref='list_notification' :dataSource='data' :showHeader='header' :headerTitle='listTitle' :template='ltemplate' :select='onComplete'></ejs-listview>
|
<ejs-listview id='listview_notification' :fields='fields' ref='list_notification' :dataSource='data' :showHeader='header' :headerTitle='listTitle' :template='ltemplate' :select='onComplete'></ejs-listview>
|
||||||
</ejs-sidebar>
|
</ejs-sidebar>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { ListViewComponent as EjsListview } from '@syncfusion/ej2-vue-lists';
|
||||||
import { ListViewPlugin } from '@syncfusion/ej2-vue-lists'
|
import { SidebarComponent as EjsSidebar } from '@syncfusion/ej2-vue-navigations';
|
||||||
import ActivityTemplate from './ActivityTemplate.vue'
|
import ActivityTemplate from './ActivityTemplate.vue';
|
||||||
|
import { createApp, ref } from "vue";
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
Vue.use(ListViewPlugin)
|
const store = useStore();
|
||||||
export default Vue.extend({
|
const list_notification = ref(null);
|
||||||
data: function () {
|
const notifybarInstance = ref(null);
|
||||||
return {
|
const app = createApp();
|
||||||
header: true,
|
|
||||||
data: this.$store.state.activityData,
|
const header = true;
|
||||||
// eslint-disable-next-line
|
const data = store.state.activityData;
|
||||||
ltemplate: function () {
|
const ltemplate = function () {
|
||||||
return {template: ActivityTemplate}
|
return {template: app.component("notificationListTemplate", ActivityTemplate)};
|
||||||
},
|
};
|
||||||
fields: { 'id': 'Employee' },
|
const fields = { 'id': 'Employee' };
|
||||||
listTitle: 'Notifications',
|
const listTitle = 'Notifications';
|
||||||
type: 'Over',
|
const type = 'Over';
|
||||||
width: '300px',
|
const width = '300px';
|
||||||
enableDock: false,
|
const enableDock = false;
|
||||||
closeOnDocumentClick: true,
|
const showBackdrop = false;
|
||||||
showBackdrop: false,
|
const sidebarTarget = navigator.userAgent.indexOf('Firefox') !== -1 ? 'body' : '.content';
|
||||||
sidebarTarget: navigator.userAgent.indexOf('Firefox') !== -1 ? 'body' : '.content',
|
const position = 'Right';
|
||||||
position: 'Right'
|
function toggle() {
|
||||||
}
|
list_notification.value.ej2Instances.reRender()
|
||||||
},
|
notifybarInstance.value.toggle()
|
||||||
methods: {
|
}
|
||||||
toggle: function () {
|
// eslint-disable-next-line
|
||||||
this.$refs.list_notification.ej2Instances.reRender()
|
function hide() {
|
||||||
this.$refs.notifybarInstance.toggle()
|
notifybarInstance.value.hide()
|
||||||
},
|
}
|
||||||
hide: function () {
|
function onComplete() {
|
||||||
this.$refs.notifybarInstance.hide()
|
}
|
||||||
},
|
// eslint-disable-next-line no-undef
|
||||||
onComplete: function () {
|
defineExpose({
|
||||||
}
|
hide,
|
||||||
}
|
toggle
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
|
||||||
<label class="e-text">Employee Name</label>
|
<label class="e-text">Employee Name</label>
|
||||||
<ejs-autocomplete id="employee" name="Emp" data-msg-containerid="errorEmp" v-model="value" v-bind:value="value" ref='employeeInstance' :dataSource='this.$store.getters.empData' :fields='fields' required></ejs-autocomplete>
|
<ejs-autocomplete id="employee" name="Emp" data-msg-containerid="errorEmp" v-model="value" v-bind:value="value" ref='employeeInstance' :dataSource='store.getters.empData' :fields='fields' required></ejs-autocomplete>
|
||||||
<div id="errorEmp"></div>
|
<div id="errorEmp"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,13 +29,13 @@
|
||||||
<div v-show="isHardware">
|
<div v-show="isHardware">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
|
||||||
<label class="e-text">Hardware</label>
|
<label class="e-text">Hardware</label>
|
||||||
<ejs-dropdownlist id="Hardware" name="Hardware" :dataSource ="this.$store.getters.hardwareNames" :fields='hardwareFields'></ejs-dropdownlist>
|
<ejs-dropdownlist id="Hardware" name="Hardware" :dataSource ="store.getters.hardwareNames" :fields='hardwareFields'></ejs-dropdownlist>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="!isHardware">
|
<div v-show="!isHardware">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
|
||||||
<label class="e-text">Software</label>
|
<label class="e-text">Software</label>
|
||||||
<ejs-dropdownlist id="Software" name="Software" :dataSource ="this.$store.getters.softwareNames" :fields='softwareFields'></ejs-dropdownlist>
|
<ejs-dropdownlist id="Software" name="Software" :dataSource ="$store.getters.softwareNames" :fields='softwareFields'></ejs-dropdownlist>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
<div class="row pull-right">
|
<div class="row pull-right">
|
||||||
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
|
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
|
||||||
<ejs-button id="primarybtn" :isPrimary="true" @click.native="addRecord">{{btnName}}</ejs-button>
|
<ejs-button id="primarybtn" :isPrimary="true" v-on:click="addRecord">{{btnName}}</ejs-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -67,200 +67,197 @@
|
||||||
</form>
|
</form>
|
||||||
</ejs-dialog>
|
</ejs-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
// eslint-disable-next-line no-unused-vars
|
||||||
import { ButtonPlugin, RadioButtonPlugin } from '@syncfusion/ej2-vue-buttons'
|
import { onMounted, computed, watch, ref, getCurrentInstance } from 'vue';
|
||||||
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
|
import { ButtonComponent as EjsButton, RadioButtonComponent as EjsRadiobutton } from '@syncfusion/ej2-vue-buttons';
|
||||||
import { DropDownListComponent, AutoCompletePlugin } from '@syncfusion/ej2-vue-dropdowns'
|
import { DatePickerComponent as EjsDatepicker } from '@syncfusion/ej2-vue-calendars';
|
||||||
import { DialogPlugin } from '@syncfusion/ej2-vue-popups'
|
import { DropDownListComponent as EjsDropdownlist, AutoCompleteComponent as EjsAutocomplete } from '@syncfusion/ej2-vue-dropdowns';
|
||||||
import { employeeData } from '../datasource.js'
|
import { DialogComponent as EjsDialog } from '@syncfusion/ej2-vue-popups';
|
||||||
import { FormValidator } from '@syncfusion/ej2-vue-inputs'
|
import { employeeData } from '../datasource.js';
|
||||||
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
|
import { FormValidator } from '@syncfusion/ej2-vue-inputs';
|
||||||
|
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
Vue.use(DialogPlugin)
|
const store = useStore();
|
||||||
Vue.use(RadioButtonPlugin)
|
const root = getCurrentInstance();
|
||||||
Vue.component(DropDownListComponent)
|
const dialogObj = ref(null);
|
||||||
Vue.use(DatePickerPlugin)
|
const employeeInstance = ref(null);
|
||||||
Vue.component(ButtonPlugin)
|
|
||||||
Vue.use(AutoCompletePlugin)
|
const priortyList = [
|
||||||
export default Vue.extend({
|
{ id: 'stat-1', text: 'Low' },
|
||||||
data: function () {
|
{ id: 'stat-2', text: 'Normal' },
|
||||||
return {
|
{ id: 'stat-3', text: 'High' },
|
||||||
priortyList: [
|
{ id: 'stat-4', text: 'Critical' }
|
||||||
{ id: 'stat-1', text: 'Low' },
|
];
|
||||||
{ id: 'stat-2', text: 'Normal' },
|
const softwareFields = { text: 'Name', value: 'TaskID' };
|
||||||
{ id: 'stat-3', text: 'High' },
|
const hardwareFields = { text: 'Name', value: 'TaskID' };
|
||||||
{ id: 'stat-4', text: 'Critical' }
|
// eslint-disable-next-line
|
||||||
],
|
const selectedType = ref('Hardware');
|
||||||
softwareFields: { text: 'Name', value: 'TaskID' },
|
let isHardware = true;
|
||||||
hardwareFields: { text: 'Name', value: 'TaskID' },
|
let header = 'Request Form';
|
||||||
selectedType: 'Hardware',
|
const target = document.body;
|
||||||
isHardware: true,
|
const showCloseIcon = true;
|
||||||
header: 'Request Form',
|
let btnName = 'Submit Request';
|
||||||
target: document.body,
|
const width = '500px';
|
||||||
showCloseIcon: true,
|
const isModal = true;
|
||||||
btnName: 'Submit Request',
|
const fields = {value: 'Employee'};
|
||||||
width: '500px',
|
// eslint-disable-next-line
|
||||||
isModal: true,
|
let enableDate = true;
|
||||||
fields: {value: 'Employee'},
|
const maxDate = new Date();
|
||||||
query: new Query().select(['id', 'Employee']),
|
const options = {
|
||||||
enableDate: true,
|
// Initialize the CustomPlacement.
|
||||||
maxDate: new Date(),
|
customPlacement: function (inputElement, errorElement) {
|
||||||
options: {
|
inputElement.parentElement.nextElementSibling.appendChild(errorElement)
|
||||||
// Initialize the CustomPlacement.
|
|
||||||
customPlacement: function (inputElement, errorElement) {
|
|
||||||
inputElement.parentElement.nextElementSibling.appendChild(errorElement)
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
Emp: { required: true },
|
|
||||||
DOR: { required: true, date: true }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
frmObj: undefined,
|
|
||||||
animationSettings: { effect: 'None' },
|
|
||||||
value: null
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
watch: {
|
rules: {
|
||||||
selectedType: function (newType) {
|
Emp: { required: true },
|
||||||
this.$dispatch('selectedType', newType)
|
DOR: { required: true, date: true }
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted: function () {
|
|
||||||
this.frmObj = new FormValidator('#formId', this.options)
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getType: function () {
|
|
||||||
this.isHardware = document.getElementById('HardwareRB').checked
|
|
||||||
},
|
|
||||||
dialogClose: function () {
|
|
||||||
this.$emit('close')
|
|
||||||
},
|
|
||||||
dialogOpen: function () {
|
|
||||||
this.frmObj.reset()
|
|
||||||
this.enableDate = true
|
|
||||||
if (!this.isEdit) {
|
|
||||||
this.header = 'Request Form'
|
|
||||||
this.btnName = 'Submit Request'
|
|
||||||
document.getElementById('employee').value = ''
|
|
||||||
document.getElementById('HardwareRB').checked = true
|
|
||||||
this.getType()
|
|
||||||
document.getElementById('Hardware').value = ''
|
|
||||||
document.getElementById('requested-on').value = new Date().toLocaleDateString()
|
|
||||||
document.getElementById('priority').value = 'Normal'
|
|
||||||
document.getElementById('note').value = ''
|
|
||||||
} else {
|
|
||||||
this.header = 'Edit Request'
|
|
||||||
this.btnName = 'Save'
|
|
||||||
var row = this.rowData
|
|
||||||
var type = row['RequestType']
|
|
||||||
document.getElementById('taskID').value = row['TaskID']
|
|
||||||
this.$refs.employeeInstance.ej2Instances.value = row['Employee']
|
|
||||||
this.$refs.employeeInstance.ej2Instances.dataBind()
|
|
||||||
document.getElementById(type + 'RB').checked = true
|
|
||||||
this.getType()
|
|
||||||
document.getElementById('requested-on').value = row['RequestedOn'].toLocaleDateString()
|
|
||||||
document.getElementById(type).value = row['RequestedItem']
|
|
||||||
document.getElementById('priority').value = row['Priority']
|
|
||||||
document.getElementById('note').value = row['Note']
|
|
||||||
}
|
|
||||||
this.$refs.dialogObj.show()
|
|
||||||
},
|
|
||||||
addRecord: function () {
|
|
||||||
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
|
|
||||||
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
|
|
||||||
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
|
|
||||||
if (this.frmObj.validate()) {
|
|
||||||
var id = this.$store.state.activityData.length
|
|
||||||
var type = document.querySelector('input[name=type]:checked').value
|
|
||||||
if (!this.isEdit) {
|
|
||||||
grid.addRecord({
|
|
||||||
'TaskID': grid.dataSource.length + 1,
|
|
||||||
'Employee': document.getElementById('employee').value,
|
|
||||||
'RequestType': type,
|
|
||||||
'RequestedItem': document.getElementById(type).value,
|
|
||||||
'Priority': document.getElementById('priority').value,
|
|
||||||
'Status': 'Pending',
|
|
||||||
'Note': document.getElementById('note').value,
|
|
||||||
'RequestedOn': new Date(document.getElementById('requested-on').value)
|
|
||||||
})
|
|
||||||
var activity = {
|
|
||||||
'id': id,
|
|
||||||
'Employee': userName,
|
|
||||||
'ImgSrc': userImg,
|
|
||||||
'TimeStamp': new Date().toLocaleDateString(),
|
|
||||||
'Message': 'A new request for ' + document.getElementById(type).value + ' has been generated'
|
|
||||||
}
|
|
||||||
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
|
||||||
this.$root.$children[0].$refs.toastRef.show({
|
|
||||||
title: 'Successs!',
|
|
||||||
content: 'Request generated successfully',
|
|
||||||
cssClass: 'e-toast-success',
|
|
||||||
icon: 'e-success toast-icons'
|
|
||||||
})
|
|
||||||
}).catch((reason) => {
|
|
||||||
alert(reason)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
var data = {'TaskID': +document.getElementById('taskID').value,
|
|
||||||
'Employee': document.getElementById('employee').value,
|
|
||||||
'RequestType': type,
|
|
||||||
'RequestedItem': document.getElementById(type).value,
|
|
||||||
'Priority': document.getElementById('priority').value,
|
|
||||||
'Note': document.getElementById('note').value,
|
|
||||||
'RequestedOn': new Date(document.getElementById('requested-on').value),
|
|
||||||
'Status': this.rowData['Status']
|
|
||||||
}
|
|
||||||
var index = grid.selectedRowIndex
|
|
||||||
grid.editModule.updateRow(index, data)
|
|
||||||
activity = {
|
|
||||||
'id': id,
|
|
||||||
'Employee': userName,
|
|
||||||
'ImgSrc': userImg,
|
|
||||||
'TimeStamp': new Date().toLocaleDateString(),
|
|
||||||
'Message': 'The request for ' + document.getElementById(type).value + ' has been updated'
|
|
||||||
}
|
|
||||||
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
|
||||||
this.$root.$children[0].$refs.toastRef.show({
|
|
||||||
title: 'Successs!',
|
|
||||||
content: 'Request updated successfully',
|
|
||||||
cssClass: 'e-toast-success',
|
|
||||||
icon: 'e-success toast-icons'
|
|
||||||
})
|
|
||||||
}).catch((reason) => {
|
|
||||||
alert(reason)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.frmObj.reset()
|
|
||||||
this.$refs.dialogObj.hide()
|
|
||||||
this.$emit('close')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
/** Whether the dialog is currently showing */
|
|
||||||
showing: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
isEdit: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
rowData: {
|
|
||||||
type: Object,
|
|
||||||
required: false,
|
|
||||||
default: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShowing () {
|
|
||||||
return this.showing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
let frmObj = undefined;
|
||||||
|
const animationSettings = { effect: 'None' };
|
||||||
|
let value = null;
|
||||||
|
|
||||||
|
// watch(selectedType, ( newValue, oldValue ) => {
|
||||||
|
// this.$dispatch('selectedType', newValue)
|
||||||
|
// })
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
onMounted(() => {
|
||||||
|
frmObj = new FormValidator('#formId', options);
|
||||||
})
|
})
|
||||||
|
function getType() {
|
||||||
|
isHardware = document.getElementById('HardwareRB').checked;
|
||||||
|
}
|
||||||
|
function dialogClose() {
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
function dialogOpen() {
|
||||||
|
frmObj.reset();
|
||||||
|
enableDate = true;
|
||||||
|
if (!props.isEdit) {
|
||||||
|
header = 'Request Form';
|
||||||
|
btnName = 'Submit Request';
|
||||||
|
document.getElementById('employee').value = '';
|
||||||
|
document.getElementById('HardwareRB').checked = true;
|
||||||
|
getType();
|
||||||
|
document.getElementById('Hardware').value = '';
|
||||||
|
document.getElementById('requested-on').value = new Date().toLocaleDateString();
|
||||||
|
document.getElementById('priority').value = 'Normal';
|
||||||
|
document.getElementById('note').value = '';
|
||||||
|
} else {
|
||||||
|
header = 'Edit Request';
|
||||||
|
btnName = 'Save';
|
||||||
|
var row = props.rowData;
|
||||||
|
var type = row['RequestType'];
|
||||||
|
document.getElementById('taskID').value = row['TaskID'];
|
||||||
|
employeeInstance.value.ej2Instances.value = row['Employee'];
|
||||||
|
employeeInstance.value.ej2Instances.dataBind();
|
||||||
|
document.getElementById(type + 'RB').checked = true;
|
||||||
|
getType();
|
||||||
|
document.getElementById('requested-on').value = row['RequestedOn'].toLocaleDateString();
|
||||||
|
document.getElementById(type).value = row['RequestedItem'];
|
||||||
|
document.getElementById('priority').value = row['Priority'];
|
||||||
|
document.getElementById('note').value = row['Note'];
|
||||||
|
}
|
||||||
|
dialogObj.value.show();
|
||||||
|
}
|
||||||
|
function addRecord() {
|
||||||
|
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
|
||||||
|
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
|
||||||
|
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
|
||||||
|
if (frmObj.validate()) {
|
||||||
|
var id = store.state.activityData.length;
|
||||||
|
var type = document.querySelector('input[name=type]:checked').value;
|
||||||
|
if (!props.isEdit) {
|
||||||
|
grid.addRecord({
|
||||||
|
'TaskID': grid.dataSource.length + 1,
|
||||||
|
'Employee': document.getElementById('employee').value,
|
||||||
|
'RequestType': type,
|
||||||
|
'RequestedItem': document.getElementById(type).value,
|
||||||
|
'Priority': document.getElementById('priority').value,
|
||||||
|
'Status': 'Pending',
|
||||||
|
'Note': document.getElementById('note').value,
|
||||||
|
'RequestedOn': new Date(document.getElementById('requested-on').value)
|
||||||
|
});
|
||||||
|
var activity = {
|
||||||
|
'id': id,
|
||||||
|
'Employee': userName,
|
||||||
|
'ImgSrc': userImg,
|
||||||
|
'TimeStamp': new Date().toLocaleDateString(),
|
||||||
|
'Message': 'A new request for ' + document.getElementById(type).value + ' has been generated'
|
||||||
|
};
|
||||||
|
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
||||||
|
root.root.refs.toastRef.show({
|
||||||
|
title: 'Successs!',
|
||||||
|
content: 'Request generated successfully',
|
||||||
|
cssClass: 'e-toast-success',
|
||||||
|
icon: 'e-success toast-icons'
|
||||||
|
});
|
||||||
|
}).catch((reason) => {
|
||||||
|
alert(reason);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var data = {
|
||||||
|
'TaskID': +document.getElementById('taskID').value,
|
||||||
|
'Employee': document.getElementById('employee').value,
|
||||||
|
'RequestType': type,
|
||||||
|
'RequestedItem': document.getElementById(type).value,
|
||||||
|
'Priority': document.getElementById('priority').value,
|
||||||
|
'Note': document.getElementById('note').value,
|
||||||
|
'RequestedOn': new Date(document.getElementById('requested-on').value),
|
||||||
|
'Status': props.rowData['Status']
|
||||||
|
};
|
||||||
|
var index = grid.selectedRowIndex;
|
||||||
|
grid.editModule.updateRow(index, data);
|
||||||
|
activity = {
|
||||||
|
'id': id,
|
||||||
|
'Employee': userName,
|
||||||
|
'ImgSrc': userImg,
|
||||||
|
'TimeStamp': new Date().toLocaleDateString(),
|
||||||
|
'Message': 'The request for ' + document.getElementById(type).value + ' has been updated'
|
||||||
|
};
|
||||||
|
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
|
||||||
|
root.root.refs.toastRef.show({
|
||||||
|
title: 'Successs!',
|
||||||
|
content: 'Request updated successfully',
|
||||||
|
cssClass: 'e-toast-success',
|
||||||
|
icon: 'e-success toast-icons'
|
||||||
|
});
|
||||||
|
}).catch((reason) => {
|
||||||
|
alert(reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
frmObj.reset();
|
||||||
|
dialogObj.value.hide();
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const emit = defineEmits(['close']);
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const props = defineProps({
|
||||||
|
/** Whether the dialog is currently showing */
|
||||||
|
showing: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
isEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
rowData: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const isShowing = computed(() => {
|
||||||
|
return props.showing;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -4,62 +4,54 @@
|
||||||
<ejs-chart style='display:block' align='center' id='chart002' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'
|
<ejs-chart style='display:block' align='center' id='chart002' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'
|
||||||
:chartArea='chartArea' :tooltip='tooltip'>
|
:chartArea='chartArea' :tooltip='tooltip'>
|
||||||
<e-series-collection>
|
<e-series-collection>
|
||||||
<e-series :dataSource='this.$store.getters.laptopData' :query='laptopQuery' type='Column' xName='key' yName='count' name='Laptop' :marker='marker' fill='#A6DC7E'> </e-series>
|
<e-series :dataSource='store.getters.laptopData' :query='laptopQuery' type='Column' xName='key' yName='count' name='Laptop' :marker='marker' fill='#A6DC7E'> </e-series>
|
||||||
<e-series :dataSource='this.$store.getters.monitorData' :query='monitorQuery' type='Column' xName='key' yName='count' name='Monitor' :marker='marker' fill='#6EB5D0'> </e-series>
|
<e-series :dataSource='store.getters.monitorData' :query='monitorQuery' type='Column' xName='key' yName='count' name='Monitor' :marker='marker' fill='#6EB5D0'> </e-series>
|
||||||
<e-series :dataSource='this.$store.getters.tabletData' :query='tabletQuery' type='Column' xName='key' yName='count' name='Tablet' :marker='marker' fill='#7E7EDC'> </e-series>
|
<e-series :dataSource='store.getters.tabletData' :query='tabletQuery' type='Column' xName='key' yName='count' name='Tablet' :marker='marker' fill='#7E7EDC'> </e-series>
|
||||||
<e-series :dataSource='this.$store.getters.miscData' :query='miscQuery' type='Column' xName='key' yName='count' name='Miscellaneous' :marker='marker' fill='#D075C6'> </e-series>
|
<e-series :dataSource='store.getters.miscData' :query='miscQuery' type='Column' xName='key' yName='count' name='Miscellaneous' :marker='marker' fill='#D075C6'> </e-series>
|
||||||
</e-series-collection>
|
</e-series-collection>
|
||||||
</ejs-chart>
|
</ejs-chart>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { provide } from 'vue';
|
||||||
import { ChartPlugin, ColumnSeries, Category, DataLabel, Tooltip, Legend } from '@syncfusion/ej2-vue-charts'
|
import { ChartComponent as EjsChart, SeriesCollectionDirective as ESeriesCollection,
|
||||||
import { Query } from '@syncfusion/ej2-data'
|
SeriesDirective as ESeries, ColumnSeries, Category, DataLabel, Tooltip, Legend } from '@syncfusion/ej2-vue-charts';
|
||||||
|
import { Query } from '@syncfusion/ej2-data';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
Vue.use(ChartPlugin)
|
const store = useStore();
|
||||||
export default Vue.extend({
|
|
||||||
data: function () {
|
const laptopQuery = new Query().take(store.getters.laptopData.length);
|
||||||
return {
|
const monitorQuery = new Query().take(store.getters.monitorData.length);
|
||||||
laptopQuery: new Query().take(this.$store.getters.laptopData.length),
|
const tabletQuery = new Query().take(store.getters.tabletData.length);
|
||||||
monitorQuery: new Query().take(this.$store.getters.monitorData.length),
|
const miscQuery = new Query().take(store.getters.miscData.length);
|
||||||
tabletQuery: new Query().take(this.$store.getters.tabletData.length),
|
|
||||||
miscQuery: new Query().take(this.$store.getters.miscData.length),
|
// Initializing Primary X Axis
|
||||||
// Initializing Primary X Axis
|
const primaryXAxis = {
|
||||||
primaryXAxis: {
|
|
||||||
valueType: 'Category', interval: 0, majorGridLines: { width: 0 }
|
valueType: 'Category', interval: 0, majorGridLines: { width: 0 }
|
||||||
},
|
};
|
||||||
chartArea: { border: { width: 0 } },
|
const chartArea = { border: { width: 0 } };
|
||||||
|
|
||||||
// Initializing Primary Y Axis
|
// Initializing Primary Y Axis
|
||||||
primaryYAxis:
|
const primaryYAxis =
|
||||||
{
|
{
|
||||||
minimum: 0,
|
minimum: 0,
|
||||||
maximum: 8,
|
maximum: 8,
|
||||||
interval: 10,
|
interval: 10,
|
||||||
majorGridLines: { width: 0 },
|
majorGridLines: { width: 0 },
|
||||||
majorTickLines: { width: 0 },
|
majorTickLines: { width: 0 },
|
||||||
lineStyle: { width: 0 },
|
lineStyle: { width: 0 },
|
||||||
labelStyle: { color: 'transparent' }
|
labelStyle: { color: 'transparent' }
|
||||||
},
|
};
|
||||||
theme: 'Fabric',
|
const marker = {
|
||||||
width: '100%',
|
dataLabel: { visible: true, position: 'Top', font: { fontWeight: '600' }}
|
||||||
marker:
|
};
|
||||||
{ dataLabel:
|
const tooltip = {
|
||||||
{ visible: true, position: 'Top', font: { fontWeight: '600' }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
enable: true
|
enable: true
|
||||||
},
|
};
|
||||||
title: 'Statistics by Hardware Category',
|
|
||||||
enableSmartLabels: true
|
provide('chart', [ColumnSeries, Legend, DataLabel, Category, Tooltip]);
|
||||||
}
|
|
||||||
},
|
|
||||||
provide: {
|
|
||||||
chart: [ColumnSeries, Legend, DataLabel, Category, Tooltip]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
|
|
@ -4,49 +4,43 @@
|
||||||
<ejs-accumulationchart ref='hardware-pie' :theme='theme' style='display:block' align='center' id='chart001'
|
<ejs-accumulationchart ref='hardware-pie' :theme='theme' style='display:block' align='center' id='chart001'
|
||||||
:legendSettings='legendSettings' :tooltip='tooltip' enableSmartLables='true'>
|
:legendSettings='legendSettings' :tooltip='tooltip' enableSmartLables='true'>
|
||||||
<e-accumulation-series-collection>
|
<e-accumulation-series-collection>
|
||||||
<e-accumulation-series :dataSource='this.$store.getters.hardwareStatus' :query='queries' xName='key' yName='count' :dataLabel='dataLabel' :startAngle='startAngle' :endAngle='endAngle' :explodeOffset='explodeOffset' :explodeIndex='explodeIndex' :radius='radius' name='Hardware' innerRadius='0%' explode='true' width=2 :palettes="colors"> </e-accumulation-series>
|
<e-accumulation-series :dataSource='store.getters.hardwareStatus' :query='queries' xName='key' yName='count' :dataLabel='dataLabel' :startAngle='startAngle' :endAngle='endAngle' :explodeOffset='explodeOffset' :explodeIndex='explodeIndex' :radius='radius' name='Hardware' innerRadius='0%' explode='true' width=2 :palettes="colors"> </e-accumulation-series>
|
||||||
</e-accumulation-series-collection>
|
</e-accumulation-series-collection>
|
||||||
</ejs-accumulationchart>
|
</ejs-accumulationchart>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { provide } from 'vue';
|
||||||
import { AccumulationChartPlugin, AccumulationTooltip, PieSeries, AccumulationDataLabel, AccumulationLegend } from '@syncfusion/ej2-vue-charts'
|
import { AccumulationChartComponent as EjsAccumulationchart, AccumulationSeriesCollectionDirective as EAccumulationSeriesCollection,
|
||||||
import { Query } from '@syncfusion/ej2-data'
|
AccumulationSeriesDirective as EAccumulationSeries, AccumulationTooltip, PieSeries, AccumulationDataLabel, AccumulationLegend } from '@syncfusion/ej2-vue-charts';
|
||||||
|
import { Query } from '@syncfusion/ej2-data';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
Vue.use(AccumulationChartPlugin)
|
const store = useStore();
|
||||||
export default Vue.extend({
|
const theme = 'Fabric';
|
||||||
data: function () {
|
const queries = new Query().take(store.getters.hardwareStatus.length);
|
||||||
return {
|
const legendSettings= {
|
||||||
theme: 'Fabric',
|
visible: true,
|
||||||
queries: new Query().take(this.$store.getters.hardwareStatus.length),
|
position: 'Bottom'
|
||||||
title: 'Statistics by Hardware Status',
|
};
|
||||||
enableSmartLabels: true,
|
const tooltip = { enable: true };
|
||||||
legendSettings: {
|
const startAngle = '0';
|
||||||
visible: true,
|
const endAngle = '360';
|
||||||
position: 'Bottom'
|
const radius = '90%';
|
||||||
},
|
const explodeOffset = '5%';
|
||||||
tooltip: { enable: true },
|
const explodeIndex = 0;
|
||||||
startAngle: '0',
|
const colors = ['#7F9FD2', '#81B8B3', '#7FD29F', '#AEEB8E'];
|
||||||
endAngle: '360',
|
const dataLabel = {
|
||||||
radius: '90%',
|
visible: true,
|
||||||
explodeOffset: '5%',
|
position: 'Inside',
|
||||||
explodeIndex: 0,
|
name: 'text',
|
||||||
colors: ['#7F9FD2', '#81B8B3', '#7FD29F', '#AEEB8E'],
|
font: {
|
||||||
dataLabel: {
|
fontWeight: '600'
|
||||||
visible: true,
|
|
||||||
position: 'Inside',
|
|
||||||
name: 'text',
|
|
||||||
font: {
|
|
||||||
fontWeight: '600'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
provide: {
|
|
||||||
accumulationchart: [AccumulationLegend, PieSeries, AccumulationTooltip, AccumulationDataLabel]
|
|
||||||
}
|
}
|
||||||
})
|
};
|
||||||
|
|
||||||
|
provide('accumulationchart', [AccumulationLegend, PieSeries, AccumulationTooltip, AccumulationDataLabel]);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
|
|
@ -8,45 +8,39 @@
|
||||||
</ejs-treemap>
|
</ejs-treemap>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { provide } from 'vue';
|
||||||
import { TreeMapPlugin, TreeMapTooltip, TreeMapLegend } from '@syncfusion/ej2-vue-treemap'
|
import { TreeMapComponent as EjsTreemap, TreeMapTooltip, TreeMapLegend } from '@syncfusion/ej2-vue-treemap';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
Vue.use(TreeMapPlugin)
|
const store = useStore();
|
||||||
export default Vue.extend({
|
const useGroupingSeparator = true;
|
||||||
data: function () {
|
const dataSource = store.state.softwareInput;
|
||||||
return {
|
const legendSettings = {
|
||||||
useGroupingSeparator: true,
|
visible: true,
|
||||||
dataSource: this.$store.state.softwareInput,
|
position: 'Bottom',
|
||||||
legendSettings: {
|
shape: 'Rectangle',
|
||||||
visible: true,
|
shapeHeight: 7,
|
||||||
position: 'Bottom',
|
shapeWidth: 7
|
||||||
shape: 'Rectangle',
|
};
|
||||||
shapeHeight: 7,
|
const palette = ['#AEEB8E', '#D075C6', '#7E7EDC', '#7EC9DC', '#D6DC7E'];
|
||||||
shapeWidth: 7
|
const tooltipSettings = {
|
||||||
},
|
visible: true,
|
||||||
palette: ['#AEEB8E', '#D075C6', '#7E7EDC', '#7EC9DC', '#D6DC7E'],
|
// eslint-disable-next-line
|
||||||
tooltipSettings: {
|
format: '${Name}<br>License Count : ${LicenseCount}'
|
||||||
visible: true,
|
};
|
||||||
// eslint-disable-next-line
|
const leafItemSettings = {
|
||||||
format: '${Name}<br>License Count : ${LicenseCount}'
|
labelPath: 'Name',
|
||||||
},
|
border: { color: '#000000', width: 0.5 }
|
||||||
leafItemSettings: {
|
};
|
||||||
labelPath: 'Name',
|
const weightValuePath = 'LicenseCount';
|
||||||
border: { color: '#000000', width: 0.5 }
|
const levels = [
|
||||||
},
|
{
|
||||||
weightValuePath: 'LicenseCount',
|
groupPath: 'Category', border: 'none' // { color: 'white', width: 0.5 }
|
||||||
levels: [
|
|
||||||
{
|
|
||||||
groupPath: 'Category', border: 'none' // { color: 'white', width: 0.5 }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
];
|
||||||
provide: {
|
provide('treemap', [TreeMapTooltip, TreeMapLegend]);
|
||||||
treemap: [TreeMapTooltip, TreeMapLegend]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
|
|
@ -9,44 +9,40 @@
|
||||||
</ejs-accumulationchart>
|
</ejs-accumulationchart>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import Vue from 'vue'
|
import { provide } from 'vue';
|
||||||
import { AccumulationChartPlugin, AccumulationTooltip, PieSeries, AccumulationDataLabel, AccumulationLegend } from '@syncfusion/ej2-vue-charts'
|
import { AccumulationChartComponent as EjsAccumulationchart,
|
||||||
import { Query } from '@syncfusion/ej2-data'
|
AccumulationSeriesCollectionDirective as EAccumulationSeriesCollection,
|
||||||
|
AccumulationSeriesDirective as EAccumulationSeries, AccumulationTooltip,
|
||||||
|
PieSeries, AccumulationDataLabel, AccumulationLegend } from '@syncfusion/ej2-vue-charts';
|
||||||
|
import { Query } from '@syncfusion/ej2-data';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
Vue.use(AccumulationChartPlugin)
|
const store = useStore();
|
||||||
export default Vue.extend({
|
|
||||||
data: function () {
|
const theme = 'Fabric';
|
||||||
return {
|
const queries= new Query().take(store.getters.softwareLicense.length);
|
||||||
theme: 'Fabric',
|
const legendSettings= {
|
||||||
queries: new Query().take(this.$store.getters.softwareLicense.length),
|
visible: true,
|
||||||
title: 'Statistics by Software License Type',
|
position: 'Bottom'
|
||||||
enableSmartLabels: true,
|
};
|
||||||
legendSettings: {
|
const tooltip = { enable: true };
|
||||||
visible: true,
|
const startAngle ='0';
|
||||||
position: 'Bottom'
|
const endAngle = '360';
|
||||||
},
|
const radius = '90%';
|
||||||
tooltip: { enable: true },
|
const explodeOffset = '5%';
|
||||||
startAngle: '0',
|
const explodeIndex = 0;
|
||||||
endAngle: '360',
|
const colors = ['#FDC288', '#A483D5', '#CB85AA'];
|
||||||
radius: '90%',
|
const dataLabel = {
|
||||||
explodeOffset: '5%',
|
visible: true,
|
||||||
explodeIndex: 0,
|
position: 'Inside',
|
||||||
colors: ['#FDC288', '#A483D5', '#CB85AA'],
|
name: 'text',
|
||||||
dataLabel: {
|
font: {
|
||||||
visible: true,
|
fontWeight: '600'
|
||||||
position: 'Inside',
|
|
||||||
name: 'text',
|
|
||||||
font: {
|
|
||||||
fontWeight: '600'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
provide: {
|
|
||||||
accumulationchart: [AccumulationLegend, PieSeries, AccumulationTooltip, AccumulationDataLabel]
|
|
||||||
}
|
}
|
||||||
})
|
};
|
||||||
|
provide('accumulationchart', [AccumulationLegend, PieSeries, AccumulationTooltip, AccumulationDataLabel]);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
164
src/main.js
164
src/main.js
|
@ -1,18 +1,148 @@
|
||||||
// The Vue build version to load with the `import` command
|
import { createApp } from 'vue'
|
||||||
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
import App from './App.vue'
|
||||||
import Vue from 'vue'
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||||
import App from './App'
|
import { createStore } from 'vuex';
|
||||||
import router from './router'
|
import { requestData, licenseData, hardwareData, softwareData, listData, employeeData } from './datasource'
|
||||||
import store from './store'
|
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
import AddHardware from './components/AddHardware.vue'
|
||||||
Vue.config.devtools = true
|
import AddSoftware from './components/AddSoftware.vue'
|
||||||
/* eslint-disable no-new */
|
import RequestForm from './components/RequestForm.vue'
|
||||||
new Vue({
|
import IssueLicense from './components/IssueLicense.vue'
|
||||||
el: '#app',
|
import AllHardware from './components/AllHardware.vue'
|
||||||
router,
|
import dashboard from './components/DashboardTemplate.vue'
|
||||||
store,
|
import AllSoftware from './components/AllSoftware.vue'
|
||||||
components: { App },
|
import AllRequests from './components/AllRequests.vue'
|
||||||
template: '<App/>',
|
import AllIssuedLicenses from './components/AllIssuedLicenses.vue'
|
||||||
data: {}
|
import About from './components/AboutTemplate.vue'
|
||||||
})
|
|
||||||
|
const routes = [
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
name: 'Dashboard',
|
||||||
|
component: dashboard
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/About',
|
||||||
|
name: 'About',
|
||||||
|
component: About
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/Software',
|
||||||
|
name: 'Software',
|
||||||
|
component: AllSoftware
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/Hardware',
|
||||||
|
name: 'Hardware',
|
||||||
|
component: AllHardware
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/AddHardware',
|
||||||
|
name: 'AddHardware',
|
||||||
|
component: AddHardware
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/AddSoftware',
|
||||||
|
name: 'AddSoftware',
|
||||||
|
component: AddSoftware
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/RequestForm',
|
||||||
|
name: 'RequestForm',
|
||||||
|
component: RequestForm
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/Requests',
|
||||||
|
name: 'Requests',
|
||||||
|
component: AllRequests
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/IssuedLicenses',
|
||||||
|
name: 'Issued Licenses',
|
||||||
|
component: AllIssuedLicenses
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/IssueLicense',
|
||||||
|
name: 'IssueLicense',
|
||||||
|
component: IssueLicense
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const store = createStore({
|
||||||
|
state: {
|
||||||
|
requestInput: requestData,
|
||||||
|
licensesInput: licenseData,
|
||||||
|
hardwareInput: hardwareData,
|
||||||
|
softwareInput: softwareData,
|
||||||
|
activityData: listData,
|
||||||
|
empInput: employeeData,
|
||||||
|
currentUserID: 2
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
requests: state => {
|
||||||
|
return new DataManager(state.requestInput).executeLocal(new Query().where(new Predicate('Status', 'notequal', 'Pending'))).length
|
||||||
|
},
|
||||||
|
pendingRequests: state => {
|
||||||
|
return new DataManager(state.requestInput).executeLocal(new Query().where(new Predicate('Status', 'equal', 'Pending'))).length
|
||||||
|
},
|
||||||
|
licenses: state => {
|
||||||
|
return state.licensesInput.length
|
||||||
|
},
|
||||||
|
hardwareNames: state => {
|
||||||
|
return new DataManager(state.hardwareInput).executeLocal(new Query().select(['Name', 'TaskID']))
|
||||||
|
},
|
||||||
|
hardwareStatus: state => {
|
||||||
|
return new DataManager(state.hardwareInput).executeLocal(new Query().group('Status'))
|
||||||
|
},
|
||||||
|
laptopData: state => {
|
||||||
|
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Laptop')).group('Status'))
|
||||||
|
},
|
||||||
|
monitorData: state => {
|
||||||
|
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Monitor')).group('Status'))
|
||||||
|
},
|
||||||
|
tabletData: state => {
|
||||||
|
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Tablet')).group('Status'))
|
||||||
|
},
|
||||||
|
miscData: state => {
|
||||||
|
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Miscellaneous')).group('Status'))
|
||||||
|
},
|
||||||
|
softwareNames: state => {
|
||||||
|
return new DataManager(state.softwareInput).executeLocal(new Query().select(['Name', 'TaskID']))
|
||||||
|
},
|
||||||
|
softwareLicense: state => {
|
||||||
|
return new DataManager(state.softwareInput).executeLocal(new Query().group('LicenseType'))
|
||||||
|
},
|
||||||
|
softwareCategory: state => {
|
||||||
|
return new DataManager(state.softwareInput).executeLocal(new Query().group('Category'))
|
||||||
|
},
|
||||||
|
empData: state => {
|
||||||
|
return new DataManager(state.empInput).executeLocal(new Query().select(['id', 'Employee']))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
addActivity (state, activity) {
|
||||||
|
state.activityData.push(activity)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
addActivity (context, activity) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
var userExist = context.state.empInput.find((user) => {
|
||||||
|
return user.Employee === activity.Employee
|
||||||
|
})
|
||||||
|
if (!userExist) {
|
||||||
|
reject(new Error('No such user found!'))
|
||||||
|
} else if (activity.Employee === '') {
|
||||||
|
reject(new Error('User name cannot be empty!'))
|
||||||
|
} else {
|
||||||
|
context.commit('addActivity', activity)
|
||||||
|
resolve(Object.assign({}, userExist))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const router = createRouter({ history: createWebHashHistory(), routes })
|
||||||
|
|
||||||
|
createApp(App).use(router).use(store).mount('#app')
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
import Vue from 'vue'
|
|
||||||
import Router from 'vue-router'
|
|
||||||
|
|
||||||
import AddHardware from '@/components/AddHardware'
|
|
||||||
import AddSoftware from '@/components/AddSoftware'
|
|
||||||
import RequestForm from '@/components/RequestForm'
|
|
||||||
import IssueLicense from '@/components/IssueLicense'
|
|
||||||
import AllHardware from '@/components/AllHardware'
|
|
||||||
import dashboard from '@/components/DashboardTemplate'
|
|
||||||
import AllSoftware from '@/components/AllSoftware'
|
|
||||||
import AllRequests from '@/components/AllRequests'
|
|
||||||
import AllIssuedLicenses from '@/components/AllIssuedLicenses'
|
|
||||||
import About from '@/components/AboutTemplate'
|
|
||||||
|
|
||||||
Vue.use(Router)
|
|
||||||
|
|
||||||
export default new Router({
|
|
||||||
routes: [
|
|
||||||
{
|
|
||||||
path: '/',
|
|
||||||
name: 'Dashboard',
|
|
||||||
component: dashboard
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/About',
|
|
||||||
name: 'About',
|
|
||||||
component: About
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/Software',
|
|
||||||
name: 'Software',
|
|
||||||
component: AllSoftware
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/Hardware',
|
|
||||||
name: 'Hardware',
|
|
||||||
component: AllHardware
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/AddHardware',
|
|
||||||
name: 'AddHardware',
|
|
||||||
component: AddHardware
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/AddSoftware',
|
|
||||||
name: 'AddSoftware',
|
|
||||||
component: AddSoftware
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/RequestForm',
|
|
||||||
name: 'RequestForm',
|
|
||||||
component: RequestForm
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/Requests',
|
|
||||||
name: 'Requests',
|
|
||||||
component: AllRequests
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/IssuedLicenses',
|
|
||||||
name: 'Issued Licenses',
|
|
||||||
component: AllIssuedLicenses
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/IssueLicense',
|
|
||||||
name: 'IssueLicense',
|
|
||||||
component: IssueLicense
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
|
@ -1,82 +0,0 @@
|
||||||
import Vue from 'vue'
|
|
||||||
import Vuex from 'vuex'
|
|
||||||
|
|
||||||
import { requestData, licenseData, hardwareData, softwareData, listData, employeeData } from '../datasource.js'
|
|
||||||
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
|
|
||||||
|
|
||||||
Vue.use(Vuex)
|
|
||||||
|
|
||||||
export default new Vuex.Store({
|
|
||||||
state: {
|
|
||||||
requestInput: requestData,
|
|
||||||
licensesInput: licenseData,
|
|
||||||
hardwareInput: hardwareData,
|
|
||||||
softwareInput: softwareData,
|
|
||||||
activityData: listData,
|
|
||||||
empInput: employeeData,
|
|
||||||
currentUserID: 2
|
|
||||||
},
|
|
||||||
getters: {
|
|
||||||
requests: state => {
|
|
||||||
return new DataManager(state.requestInput).executeLocal(new Query().where(new Predicate('Status', 'notequal', 'Pending'))).length
|
|
||||||
},
|
|
||||||
pendingRequests: state => {
|
|
||||||
return new DataManager(state.requestInput).executeLocal(new Query().where(new Predicate('Status', 'equal', 'Pending'))).length
|
|
||||||
},
|
|
||||||
licenses: state => {
|
|
||||||
return state.licensesInput.length
|
|
||||||
},
|
|
||||||
hardwareNames: state => {
|
|
||||||
return new DataManager(state.hardwareInput).executeLocal(new Query().select(['Name', 'TaskID']))
|
|
||||||
},
|
|
||||||
hardwareStatus: state => {
|
|
||||||
return new DataManager(state.hardwareInput).executeLocal(new Query().group('Status'))
|
|
||||||
},
|
|
||||||
laptopData: state => {
|
|
||||||
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Laptop')).group('Status'))
|
|
||||||
},
|
|
||||||
monitorData: state => {
|
|
||||||
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Monitor')).group('Status'))
|
|
||||||
},
|
|
||||||
tabletData: state => {
|
|
||||||
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Tablet')).group('Status'))
|
|
||||||
},
|
|
||||||
miscData: state => {
|
|
||||||
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Miscellaneous')).group('Status'))
|
|
||||||
},
|
|
||||||
softwareNames: state => {
|
|
||||||
return new DataManager(state.softwareInput).executeLocal(new Query().select(['Name', 'TaskID']))
|
|
||||||
},
|
|
||||||
softwareLicense: state => {
|
|
||||||
return new DataManager(state.softwareInput).executeLocal(new Query().group('LicenseType'))
|
|
||||||
},
|
|
||||||
softwareCategory: state => {
|
|
||||||
return new DataManager(state.softwareInput).executeLocal(new Query().group('Category'))
|
|
||||||
},
|
|
||||||
empData: state => {
|
|
||||||
return new DataManager(state.empInput).executeLocal(new Query().select(['id', 'Employee']))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
addActivity (state, activity) {
|
|
||||||
state.activityData.push(activity)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
addActivity (context, activity) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
var userExist = context.state.empInput.find((user) => {
|
|
||||||
return user.Employee === activity.Employee
|
|
||||||
})
|
|
||||||
if (!userExist) {
|
|
||||||
reject(new Error('No such user found!'))
|
|
||||||
} else if (activity.Employee === '') {
|
|
||||||
reject(new Error('User name cannot be empty!'))
|
|
||||||
} else {
|
|
||||||
context.commit('addActivity', activity)
|
|
||||||
resolve(Object.assign({}, userExist))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -1,5 +1,6 @@
|
||||||
const { defineConfig } = require('@vue/cli-service')
|
const { defineConfig } = require('@vue/cli-service')
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
|
publicPath: '',
|
||||||
transpileDependencies: true,
|
transpileDependencies: true,
|
||||||
runtimeCompiler: true
|
runtimeCompiler: true
|
||||||
})
|
})
|
||||||
|
|
Загрузка…
Ссылка в новой задаче