feature(EJ2-66719): Need to update the asset management showcase sample.

This commit is contained in:
Anbumani Rajendracholan 2022-12-14 19:24:35 +05:30
Родитель 59aaa5a909
Коммит fa1fe67078
36 изменённых файлов: 4914 добавлений и 82 удалений

Просмотреть файл

@ -1,24 +1,22 @@
# ej2-showcase-vue-asset-management
# 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).
## Project setup
```
npm install
```
## Prerequisites
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.
### Compiles and hot-reloads for development
```
npm run serve
```
## Build Setup
### Compiles and minifies for production
```
npm run build
```
### Install dependencies
npm install
### Lints and fixes files
```
npm run lint
```
### Serve with hot reload at localhost:8080
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.
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
### Build for production with minification
npm run build
## Demo
[Asset Management System](https://ej2.syncfusion.com/showcase/vue/assetmanagement)
Also please check out other showcase samples built using Essential JS 2 components [here](https://ej2.syncfusion.com/home/vue.html).

Просмотреть файл

@ -1,6 +1,8 @@
{
"name": "ej2-showcase-vue-asset-management",
"version": "0.1.0",
"name": "@syncfusion/ej2-vue-asset-management",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "Syncfusion Inc.",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
@ -8,14 +10,13 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@syncfusion/ej2-vue-grids": "*",
"@syncfusion/ej2-vue-base": "*",
"@syncfusion/ej2-vue-buttons": "*",
"@syncfusion/ej2-vue-calendars": "*",
"@syncfusion/ej2-vue-charts": "*",
"@syncfusion/ej2-vue-dropdowns": "*",
"@syncfusion/ej2-vue-inputs": "*",
"@syncfusion/ej2-vue-lists": "*",
"@syncfusion/ej2-vue-grids": "*",
"@syncfusion/ej2-vue-navigations": "*",
"@syncfusion/ej2-vue-notifications": "*",
"@syncfusion/ej2-vue-popups": "*",

Просмотреть файл

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<title>IT Asset Management - Essential JS 2 for Vue - Syncfusion</title>
<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 href="https://cdn.syncfusion.com/ej2/fabric.css" rel="stylesheet"/>

12
src/assets/Approve.svg Normal file
Просмотреть файл

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
<title>Shape</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Asset-View" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Asset-View_4-Copy-5" transform="translate(-1105.000000, -287.000000)" fill="#0BB60E">
<path d="M1113,287 C1108.584,287 1105,290.584 1105,295 C1105,299.416 1108.584,303 1113,303 C1117.416,303 1121,299.416 1121,295 C1121,290.584 1117.416,287 1113,287 L1113,287 Z M1111.4,299 L1107.4,295 L1108.528,293.872 L1111.4,296.736 L1117.472,290.664 L1118.6,291.8 L1111.4,299 L1111.4,299 Z" id="Shape"></path>
</g>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 887 B

Просмотреть файл

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
<g transform="matrix(1,0,0,1,-130,0)">
<g id="Artboard1" transform="matrix(1.0049,0,0,1.0049,1000.6,78.5181)">
<rect x="-866.353" y="-78.135" width="99.512" height="99.512" style="fill:none;"/>
<clipPath id="_clip1">
<rect x="-866.353" y="-78.135" width="99.512" height="99.512"/>
</clipPath>
<g clip-path="url(#_clip1)">
<g transform="matrix(0.995123,0,0,0.995123,-868.828,-78.3849)">
<rect x="-0.794" y="-2.767" width="108.671" height="108.647" style="fill:rgb(235,231,245);"/>
</g>
<g transform="matrix(0.166474,0,0,0.166474,-896.049,-88.135)">
<path d="M254.302,549.362C254.302,549.362 316.971,559.441 303.513,506.757C303.513,506.757 270.153,334.489 326.678,212.097C326.678,212.097 374.905,123.734 500.187,131.96C500.187,131.96 625.664,132.723 654.812,270.482C654.812,270.482 678.236,360.081 655.984,508.148C655.984,508.148 641.87,553.489 704.202,550.072C704.202,550.072 710.95,604.133 628.415,626.107C628.415,626.107 428.033,661.159 315.569,622.112C315.569,622.112 255.407,605.566 254.302,549.362Z" style="fill:rgb(81,54,42);"/>
</g>
<g transform="matrix(0.165474,0,0,0.172795,-736.617,183.585)">
<rect x="-518.041" y="-1090.29" width="78.996" height="88.618" style="fill:rgb(252,188,133);"/>
</g>
<g transform="matrix(0.166474,0,0,0.166474,-896.049,-88.135)">
<path d="M536.186,292.194C536.186,292.194 472.071,328.131 408.541,315.706C408.541,315.706 373.97,314.539 354.72,358.13C354.72,358.13 314.732,475.351 424.263,522.139C424.263,522.139 542.372,563.426 595.656,473.342C595.656,473.342 618.424,441.331 609.657,390.51C603.459,354.577 596.646,320.728 536.186,292.194Z" style="fill:rgb(253,204,154);"/>
</g>
<g transform="matrix(0.166474,0,0,0.166474,-895.272,-88.0923)">
<ellipse cx="551.296" cy="383.071" rx="14.582" ry="15.994" style="fill:rgb(59,37,25);"/>
</g>
<g transform="matrix(0.166474,0,0,0.166474,-918.519,-87.9776)">
<ellipse cx="551.296" cy="383.071" rx="14.582" ry="15.994" style="fill:rgb(59,37,25);"/>
</g>
<g transform="matrix(0.20877,0,0,0.190688,-715.369,200.05)">
<path d="M-660.79,-937.651C-660.79,-937.651 -646.839,-1013.27 -481.054,-1033.48C-481.054,-1033.48 -322.59,-1023.88 -290.574,-936.918L-660.79,-937.651Z" style="fill:rgb(87,67,166);"/>
<clipPath id="_clip2">
<path d="M-660.79,-937.651C-660.79,-937.651 -646.839,-1013.27 -481.054,-1033.48C-481.054,-1033.48 -322.59,-1023.88 -290.574,-936.918L-660.79,-937.651Z"/>
</clipPath>
<g clip-path="url(#_clip2)">
<g transform="matrix(1,0,0,1,-5.19525,0.760608)">
<path d="M-533.459,-1026.54C-533.459,-1026.54 -480.384,-965.303 -418.39,-1025.48L-439.309,-1030.25C-439.309,-1030.25 -472.854,-997.266 -515.475,-1030.82L-533.459,-1026.54Z" style="fill:rgb(244,108,32);"/>
</g>
<g transform="matrix(1,0,0,1,-5.91366,-16.1724)">
<path d="M-533.459,-1026.54C-533.459,-1026.54 -478.44,-959.351 -418.39,-1025.48L-439.309,-1030.25C-439.309,-1030.25 -469.645,-1004.64 -515.475,-1030.82L-533.459,-1026.54Z" style="fill:rgb(252,188,133);"/>
</g>
</g>
</g>
<g transform="matrix(0.172795,0,0,0.172795,-733.043,182.911)">
<path d="M-516.7,-1117.73C-516.7,-1117.73 -505.309,-1112.65 -495.293,-1110.87C-495.293,-1110.87 -476.744,-1106.99 -459.636,-1110.59C-459.636,-1110.59 -443.693,-1114.19 -437.312,-1118.25C-437.312,-1118.25 -438.692,-1108.61 -460.159,-1105.79C-460.159,-1105.79 -496.085,-1098.01 -516.7,-1117.73Z" style="fill:rgb(247,148,94);"/>
</g>
</g>
</g>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 4.5 KiB

Просмотреть файл

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
<g id="Artboard1" transform="matrix(1.0049,0,0,1.0049,870.599,78.5181)">
<rect x="-866.353" y="-78.135" width="99.512" height="99.512" style="fill:none;"/>
<clipPath id="_clip1">
<rect x="-866.353" y="-78.135" width="99.512" height="99.512"/>
</clipPath>
<g clip-path="url(#_clip1)">
<g transform="matrix(0.995123,0,0,0.995123,-866.353,-78.1351)">
<rect x="-0.794" y="-2.767" width="108.671" height="108.647" style="fill:rgb(235,231,245);"/>
</g>
<g transform="matrix(0.172795,0,0,0.172795,-757.49,104.713)">
<g transform="matrix(1,0,0,1,144.361,458.451)">
<ellipse cx="-624.73" cy="-1203.65" rx="34.422" ry="40.273" style="fill:rgb(252,188,133);"/>
</g>
<g transform="matrix(1,0,0,1,445.558,457.821)">
<ellipse cx="-624.73" cy="-1203.65" rx="34.422" ry="40.273" style="fill:rgb(252,188,133);"/>
</g>
<g transform="matrix(0.957635,0,0,1,129.494,462.081)">
<rect x="-518.041" y="-1090.29" width="78.996" height="88.618" style="fill:rgb(252,188,133);"/>
</g>
<g transform="matrix(1.06198,0,0,1.17243,184.902,695.246)">
<circle cx="-484.628" cy="-1235.94" r="135.778" style="fill:rgb(253,204,154);"/>
</g>
<g transform="matrix(1,0,0,1,147.24,452.549)">
<path d="M-627.757,-1189.41C-627.757,-1189.41 -641.002,-1202.47 -641.517,-1311.06C-641.517,-1311.06 -653.95,-1404.69 -550.946,-1435.93C-550.946,-1435.93 -433.033,-1482.51 -354.806,-1399.98C-354.806,-1399.98 -261.635,-1370.17 -331.729,-1188.38C-331.729,-1188.38 -338.647,-1172.11 -343.678,-1231.58C-343.678,-1231.58 -346.728,-1268.8 -368.958,-1275.1C-368.958,-1275.1 -393.606,-1289.01 -404.168,-1309.56C-404.168,-1309.56 -455.08,-1281.42 -541.193,-1291.69C-541.193,-1291.69 -603.411,-1295.7 -611.958,-1245.84C-614.948,-1233.09 -606.166,-1162.12 -627.757,-1189.41Z" style="fill:rgb(81,54,42);"/>
</g>
<g transform="matrix(1.11994,0,0,1,201.581,454.34)">
<ellipse cx="-408.225" cy="-1209.76" rx="13.873" ry="18.102" style="fill:rgb(59,37,25);"/>
</g>
<g transform="matrix(1.11994,0,0,1,56.7485,452.915)">
<ellipse cx="-408.225" cy="-1209.76" rx="13.873" ry="18.102" style="fill:rgb(59,37,25);"/>
</g>
<g transform="matrix(1,0,0,1,147.24,452.549)">
<path d="M-516.7,-1117.73C-516.7,-1117.73 -505.309,-1112.65 -495.293,-1110.87C-495.293,-1110.87 -476.744,-1106.99 -459.636,-1110.59C-459.636,-1110.59 -443.693,-1114.19 -437.312,-1118.25C-437.312,-1118.25 -438.692,-1108.61 -460.159,-1105.79C-460.159,-1105.79 -496.085,-1098.01 -516.7,-1117.73Z" style="fill:rgb(247,148,94);"/>
</g>
<g transform="matrix(1.2082,0,0,1.10355,250.722,557.805)">
<path d="M-660.79,-937.651C-660.79,-937.651 -646.839,-1013.27 -481.054,-1033.48C-481.054,-1033.48 -322.59,-1023.88 -290.574,-936.918L-660.79,-937.651Z" style="fill:rgb(87,67,166);"/>
<clipPath id="_clip2">
<path d="M-660.79,-937.651C-660.79,-937.651 -646.839,-1013.27 -481.054,-1033.48C-481.054,-1033.48 -322.59,-1023.88 -290.574,-936.918L-660.79,-937.651Z"/>
</clipPath>
<g clip-path="url(#_clip2)">
<g transform="matrix(1,0,0,1,-5.19525,0.760608)">
<path d="M-533.459,-1026.54C-533.459,-1026.54 -480.384,-965.303 -418.39,-1025.48L-439.309,-1030.25C-439.309,-1030.25 -472.854,-997.266 -515.475,-1030.82L-533.459,-1026.54Z" style="fill:rgb(244,108,32);"/>
</g>
<g transform="matrix(1,0,0,1,-5.91366,-16.1724)">
<path d="M-533.459,-1026.54C-533.459,-1026.54 -478.44,-959.351 -418.39,-1025.48L-439.309,-1030.25C-439.309,-1030.25 -469.645,-1004.64 -515.475,-1030.82L-533.459,-1026.54Z" style="fill:rgb(252,188,133);"/>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Двоичные данные
src/assets/Line.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 137 B

12
src/assets/Logout.svg Normal file
Просмотреть файл

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
<g transform="matrix(1,0,0,1,-179.717,-148.495)">
<g id="Page-57" serif:id="Page 57" transform="matrix(0.8,0,0,0.8,179.717,148.495)">
<rect x="0" y="0" width="20" height="20" style="fill:none;"/>
<g transform="matrix(0.972238,0,0,0.972238,-174.45,-144.095)">
<path d="M194.895,151.133L193.743,152.768C195.605,154.08 196.717,156.221 196.717,158.495C196.717,162.355 193.577,165.495 189.717,165.495C185.857,165.495 182.717,162.355 182.717,158.495C182.717,156.225 183.826,154.086 185.683,152.774L184.529,151.141C182.142,152.826 180.717,155.575 180.717,158.495C180.717,163.458 184.755,167.495 189.717,167.495C194.68,167.495 198.717,163.458 198.717,158.495C198.717,155.571 197.288,152.82 194.895,151.133ZM190.717,155.495L188.717,155.495L188.717,149.495L190.717,149.495L190.717,155.495Z" style="fill:rgb(153,153,153);"/>
</g>
</g>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

15
src/assets/Profile.svg Normal file
Просмотреть файл

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
<g transform="matrix(1,0,0,1,-199.463,-148.64)">
<g id="Page-32" serif:id="Page 32" transform="matrix(0.8,0,0,0.8,199.463,148.64)">
<rect x="0" y="0" width="20" height="20" style="fill:none;"/>
<g transform="matrix(1.07279,0,0,1.07279,13.8139,18.5551)">
<path d="M0,-7.019C-1.034,-6.239 -2.319,-5.776 -3.71,-5.776C-5.103,-5.776 -6.387,-6.239 -7.421,-7.019C-9.84,-6.714 -11.711,-4.646 -11.711,-2.14L-11.711,0L4.289,0L4.289,-2.14C4.289,-4.646 2.418,-6.714 0,-7.019" style="fill:rgb(153,153,153);fill-rule:nonzero;"/>
</g>
<g transform="matrix(1.07279,0,0,1.07279,9.98537,1.05512)">
<path d="M0,8.983C2.48,8.983 4.491,6.972 4.491,4.491C4.491,2.011 2.48,0 0,0C-2.481,0 -4.491,2.011 -4.491,4.491C-4.491,6.972 -2.481,8.983 0,8.983" style="fill:rgb(153,153,153);fill-rule:nonzero;"/>
</g>
</g>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

12
src/assets/Reject.svg Normal file
Просмотреть файл

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
<title>Shape</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Asset-View" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Asset-View_4-Copy-5" transform="translate(-1105.000000, -336.000000)" fill="#F64F4C">
<path d="M1113,336 C1108.576,336 1105,339.576 1105,344 C1105,348.424 1108.576,352 1113,352 C1117.424,352 1121,348.424 1121,344 C1121,339.576 1117.424,336 1113,336 L1113,336 Z M1117,346.872 L1115.872,348 L1113,345.128 L1110.128,348 L1109,346.872 L1111.872,344 L1109,341.128 L1110.128,340 L1113,342.872 L1115.872,340 L1117,341.128 L1114.128,344 L1117,346.872 L1117,346.872 Z" id="Shape"></path>
</g>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 969 B

Двоичные данные
src/assets/asset-management-logo.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.9 KiB

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичные данные
src/assets/fonts/controls.eot Normal file

Двоичный файл не отображается.

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

После

Ширина:  |  Высота:  |  Размер: 337 KiB

Двоичные данные
src/assets/fonts/controls.ttf Normal file

Двоичный файл не отображается.

Двоичные данные
src/assets/fonts/controls.woff Normal file

Двоичный файл не отображается.

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -0,0 +1,55 @@
<style>
#list-engineer {
font-size: 14px;
color: #262628;
font-weight: 600;
padding-left: 5px;
}
#list-timeStamp {
float: right;
color: #696868;
opacity: 40%;
font-size: 11px;
font-family: Roboto, Helvetica, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
/* background-repeat: no-repeat;
background-image: url('../assets/Timer.png');
background-position: left center; */
padding-left: 18px;
/* margin-top: 15px; */
}
.list-temp {
height: 65px;
line-height: 15px !important;
font-family: helvetica;
}
/* .e-listview .e-list-item { */
#list-message {
font-size: 13px;
color: #868686;
margin-left: 40px;
}
</style>
<template>
<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>
<span id= "list-engineer">{{data.Employee}}</span>
<span id="list-timeStamp" class="sf-icon-timer" >{{data.TimeStamp}}</span>
<p id="list-message">{{data.Message}}</p>
</div>
</template>
<script>
export default {
data () {
return {
data: {},
bgSize: 'cover'
}
},
computed: {
image: function () {
return require('@/' + this.data.ImgSrc)
}
}
}
</script>

Просмотреть файл

@ -0,0 +1,375 @@
<template>
<ejs-dialog ref="dialogObj" id="dialog" :isModal='isModal' v-bind:visible="isShowing" :header='header' :animationSettings='animationSettings' :allowDragging='true' :showCloseIcon='showCloseIcon' :target='target' :width='width' :open="dialogOpen" :close="dialogClose">
<!-- <form id="formId" class="form-horizontal" novalidate=""> -->
<form id="formId" class="dlg-form" novalidate="">
<div class="col-lg-12 e-input-section">
<div class="content-wrapper">
<div class="row" v-show="isEdit">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Task ID</label>
<input id="taskID" class="e-input" type="text" disabled>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<!-- <div class="e-float-input"> -->
<!-- <span class="e-float-line"></span> -->
<label class="e-text">Hardware Name</label>
<input id="name" name="Name" class="e-input" type="text" required>
<!-- </div> -->
</div>
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<!-- <div class="e-float-input"> -->
<label class="e-text">Category</label>
<ejs-dropdownlist id="category" name="Category" class="e-input" :dataSource ="categoryList"></ejs-dropdownlist>
<!-- <span class="e-float-line"></span> -->
<!-- </div> -->
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<!-- <div class="e-float-input"> -->
<label class="e-text">Serial No</label>
<input id="serial" name="Serial" class="e-input" type="text" required>
<!-- <span class="e-float-line"></span> -->
<!-- </div> -->
</div>
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<!-- <div class="e-float-input"> -->
<label class="e-text">Invoice ID</label>
<input id="invoice" name="Invoice" class="e-input" type="text" required>
<!-- <span class="e-float-line"></span> -->
<!-- </div> -->
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<!-- <div class="e-float-input"> -->
<label class="e-text">Date Of Purchase</label>
<ejs-datepicker id="dop" name="DOP" data-msg-containerid="errorID" type="text" class="e-input" :max="maxDate"></ejs-datepicker>
<div id="errorID"></div>
<!-- <span class="e-float-line"></span> -->
<!-- </div> -->
</div>
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<!-- <div class="e-float-input"> -->
<label class="e-text">Warranty Ends On</label>
<ejs-datepicker id="weo" class="e-input" :min="maxDate"></ejs-datepicker>
<!-- <span class="e-float-line"></span> -->
<!-- </div> -->
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<!-- <div class="e-float-input"> -->
<label class="e-text">Status</label>
<ejs-dropdownlist id="status" name="Status" class="e-input" :dataSource ="statusList" :change='onChange'></ejs-dropdownlist>
<!-- <span class="e-float-line"></span> -->
<!-- </div> -->
</div>
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12" v-show="showAssignee">
<!-- <div class="e-float-input"> -->
<label class="e-text">Assigned To</label>
<ejs-autocomplete id="assignee" :dataSource='this.$store.getters.empData' :fields='fields'></ejs-autocomplete>
<!-- <span class="e-float-line"></span> -->
<!-- </div> -->
</div>
</div>
<div class="row" v-show="showUploader" >
<div class="col-xs-12 col-sm-12 col-lg-8 col-md-12 upload-box">
<ejs-uploader class="e-input" ref="uploadObj" id='defaultfileupload' name="UploadFiles" :asyncSettings= "path"
:dropArea = "dropElement" :removing= "onFileRemove"></ejs-uploader>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-lg-12 col-md-12">
<!-- <div class="e-float-input"> -->
<label class="e-text">Note</label> <br>
<textarea id="note" class="e-input" rows="4"></textarea>
<!-- <span class="e-float-line"></span> -->
<!-- </div> -->
</div>
</div>
<div class="row pull-right">
<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>
</div>
</div>
</div>
</div>
</form>
</ejs-dialog>
</template>
<script>
import Vue from 'vue'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListPlugin } from '@syncfusion/ej2-vue-dropdowns'
import { DialogPlugin } from '@syncfusion/ej2-vue-popups'
import { UploaderPlugin, FormValidator } from '@syncfusion/ej2-vue-inputs'
import { ToastPlugin } from '@syncfusion/ej2-vue-notifications'
import { employeeData } from '../datasource.js'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
Vue.use(ToastPlugin)
Vue.use(DialogPlugin)
Vue.use(DropDownListPlugin)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
Vue.use(UploaderPlugin)
export default Vue.extend({
data: function () {
return {
categoryList: [
{ id: 'cat-1', text: 'Laptop' },
{ id: 'cat-2', text: 'Monitor' },
{ id: 'cat-3', text: 'Keyboard' },
{ id: 'cat-4', text: 'Mouse' },
{ id: 'cat-5', text: 'Tablet' },
{ id: 'cat-6', text: 'Mobile' },
{ id: 'cat-7', text: 'Headset' },
{ id: 'cat-8', text: 'Miscellaneous' }
],
statusList: [
{ id: 'stat-1', text: 'Ordered' },
{ id: 'stat-2', text: 'Pending' },
{ id: 'stat-3', text: 'Assigned' },
{ id: 'stat-4', text: 'In-repair' }
],
header: 'Add New Hardware',
target: document.body,
showCloseIcon: true,
width: '500px',
btnName: 'Submit',
animationSettings: { effect: 'None' },
isModal: true,
maxDate: new Date(),
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 () {
this.frmObj = new FormValidator('#formId', this.options)
},
methods: {
onChange: function () {
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
}
}
})
</script>
<style scoped>
.content-wrapper {
width: 100%;
margin: 0 auto;
min-width: 185px;
}
.content-wrapper div.row {
padding: 5px 0px;
}
.control-label {
padding: 24px 0px 0px 0px;
font-size: 12px;
opacity: 0.54;
}
@media only screen and (max-width: 480px) {
.content-wrapper {
width: 92%;
}
.e-input-section .col-xs-6,
.e-input-section .col-xs-4,
.e-input-section .col-xs-12 {
padding: 10px 5px;
width: 100%;
}
.content-wrapper div.row {
padding: 0px;
}
#dialog {
top: 10px;
/* height: 100%; */
}
}
.upload-box {
padding-top: 15px;
}
</style>

Просмотреть файл

@ -0,0 +1,303 @@
<template>
<ejs-dialog ref="dialogObj" id="dialog" :isModal='isModal' v-bind:visible="isShowing" :header='header' :animationSettings='animationSettings' :allowDragging='true' :showCloseIcon='showCloseIcon' :target='target' :width='width' :open="dialogOpen" :close="dialogClose">
<form id="formId" class="dlg-form" novalidate="">
<div class="col-lg-12 e-input-section">
<div class="content-wrapper">
<div class="row" v-show="isEdit">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Task ID</label>
<input id="taskID" class="e-input" type="text" disabled>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Software Name</label>
<input id="name" name="Name" class="e-input" type="text" required>
</div>
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Edition</label>
<input id="edition" class="e-input" type="text">
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Version</label>
<input id="version" class="e-input" type="text">
</div>
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Vendor</label>
<input id="vendor" class="e-input" type="text">
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">License Type</label>
<ejs-dropdownlist id="license-type" name="Type" :dataSource ="LicenseList"></ejs-dropdownlist>
</div>
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">No. of Licenses</label>
<ejs-numerictextbox id="license-count" format="n" :min="0"></ejs-numerictextbox>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Date Of Purchase</label>
<ejs-datepicker class="e-input" data-msg-containerid="errorID" :max="maxDate" id="dop" name="DOP" ></ejs-datepicker>
<div id="errorID"></div>
</div>
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Expired On</label>
<ejs-datepicker class="e-input" :min="maxDate" id="expired-on"></ejs-datepicker>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Category</label>
<ejs-dropdownlist :dataSource ="categoryList" id="category" name="Category"></ejs-dropdownlist>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-lg-12 col-md-12">
<label class="e-text">Note</label>
<textarea id="note" class="e-input" rows="4"></textarea>
</div>
</div>
<div class="row pull-right">
<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>
</div>
</div>
</div>
</div>
</form>
</ejs-dialog>
</template>
<script>
import Vue from 'vue'
import { ButtonComponent, ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import { NumericTextBoxPlugin, FormValidator } from '@syncfusion/ej2-vue-inputs'
import { DialogPlugin } from '@syncfusion/ej2-vue-popups'
import { employeeData } from '../datasource.js'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
Vue.use(DialogPlugin)
Vue.component(DropDownListComponent)
Vue.use(NumericTextBoxPlugin)
Vue.use(DatePickerPlugin)
Vue.component(ButtonPlugin.name, ButtonComponent)
export default Vue.extend({
data: function () {
return {
categoryList: [
{ id: 'cat-1', text: 'Development' },
{ id: 'cat-2', text: 'Graphics' },
{ id: 'cat-3', text: 'Accounting' },
{ id: 'cat-4', text: 'HR' },
{ id: 'cat-5', text: 'Common' },
{ id: 'cat-6', text: 'Miscellaneous' }
],
LicenseList: [
{ id: 'Lic-1', text: 'Free' },
{ id: 'Lic-2', text: 'Yearly (User basis)' },
{ id: 'Lic-3', text: 'Lifetime' }
],
header: 'Add New Software',
target: document.body,
showCloseIcon: true,
btnName: 'Submit',
width: '500px',
isModal: true,
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 () {
this.frmObj = new FormValidator('#formId', this.options)
},
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
}
}
})
</script>
<style scoped>
.content-wrapper {
width: 100%;
margin: 0 auto;
min-width: 185px;
}
.content-wrapper div.row {
padding: 5px 0px;
}
.control-label {
padding: 24px 0px 0px 0px;
font-size: 12px;
opacity: 0.54;
}
@media only screen and (max-width: 480px) {
.content-wrapper {
width: 92%;
}
.e-input-section .col-xs-6,
.e-input-section .col-xs-4,
.e-input-section .col-xs-12 {
padding: 10px 5px;
width: 100%;
}
.content-wrapper div.row {
padding: 0px;
}
#dialog {
top: 10px;
/* height: 100%; */
}
}
</style>

Просмотреть файл

@ -0,0 +1,180 @@
<template id="view-hardware">
<div class="container-fluid">
<div id="dialog" style="padding:10px;position:absolute;">
<add-hardware :showing="dlgShow" :isEdit="isEditing" :rowData="rowData" @close="onDlgClose">
</add-hardware>
</div>
<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-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>
</div>
<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>
</div>
</div>
<div class="row">
<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'>
<e-columns>
<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='Category' headerText='Category' :filter='filter' width=90 :required='true'></e-column>
<e-column field='SerialNo' headerText='Serial No' width=80 required=true></e-column>
<e-column field='InvoiceNo' headerText='Invoice' width=70 required=true></e-column>
<e-column field='DOP' headerText='Purchase Date' textAlign='Right' type='date' editType='datepickeredit' format='yMd' width=110 required=true></e-column>
<e-column field='WEO' headerText='Warranty Ends on' textAlign='Right' type='date' seditType='datepickeredit' format='yMd' width=120 required=true></e-column>
<e-column field='Status' headerText='Status' :filter='filter' width=70 required=true></e-column>
<e-column field='AssignedTo' headerText='Assigned To' width=90></e-column>
<e-column field='Note' headerText='Notes' :visible='false'></e-column>
<e-column headerText='' width='100' :commands='commands'></e-column>
</e-columns>
</ejs-grid>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue'
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import AddHardware from '@/components/AddHardware'
import { hardwareData } from '../datasource.js'
import { TooltipPlugin, Tooltip } from '@syncfusion/ej2-vue-popups'
import { Browser } from '@syncfusion/ej2-base'
Vue.use(DateRangePickerPlugin)
Vue.use(GridPlugin)
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
Vue.use(TooltipPlugin)
export default Vue.extend({
data: function () {
return {
dlgShow: false,
isEditing: false,
rowData: null,
waterMark: 'Select a range',
gridData: hardwareData,
tooltip: '',
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 },
query: '',
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[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>
<style scoped>
.datepicker-panel{
float: right;
margin-right:20px;
}
.datepicker-panel-group{
display: flex;
}
.content-wrapper {
width: 100%;
margin: 15px auto;
min-width: 185px;
}
@media only screen and (max-width: 480px) {
.content-wrapper {
width: 92%;
}
}
.e-add-icon {
background-repeat: no-repeat;
/* background-image: url('../assets/Plus.png'); */
}
</style>

Просмотреть файл

@ -0,0 +1,163 @@
<template id="view-hardware">
<div class="container-fluid">
<div id="dialog" style="padding:10px;position:absolute;">
<issue-license :showing="dlgShow" :isEdit="isEditing" :rowData="rowData" @close="onDlgClose">
</issue-license>
</div>
<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-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>
</div>
<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>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<ejs-grid ref="gridObj" class="r-space" :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-column field='TaskID' headerText='Task ID' textAlign='Right' width=60 :isPrimaryKey='true'></e-column>
<e-column field='Employee' headerText='Employee' width=90></e-column>
<e-column field='Email' headerText='Email' clipMode='EllipsisWithTooltip' width=120></e-column>
<e-column field='Software' headerText='Software' :filter='filter' width=100></e-column>
<e-column field='LicenseKey' headerText='License Key' :filter='filter' clipMode='EllipsisWithTooltip' width=100></e-column>
<e-column field='IssuedOn' headerText='Issued On' textAlign='Right' type='date' editType='datepickeredit' format='yMd' width=80></e-column>
<e-column field='Note' headerText='Notes' :visible='false'></e-column>
<e-column headerText='' width='60' :commands='commands'></e-column>
</e-columns>
</ejs-grid>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue'
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import IssueLicense from '@/components/IssueLicense'
import { licenseData } from '../datasource.js'
import { Browser } from '@syncfusion/ej2-base'
Vue.use(DateRangePickerPlugin)
Vue.use(GridPlugin)
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
export default Vue.extend({
data: function () {
return {
dlgShow: 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
}
})
</script>
<style scoped>
#primarybtn{
/* display: block !important; */
margin-right:20px;
}
.datepicker-panel{
float: right;
margin-right:20px;
}
.datepicker-panel-group{
display: flex;
}
.content-wrapper {
width: 100%;
margin: 15px auto;
min-width: 185px;
}
@media only screen and (max-width: 480px) {
.content-wrapper {
width: 92%;
}
}
</style>

Просмотреть файл

@ -0,0 +1,292 @@
<template id="view-hardware">
<div class="container-fluid">
<div id="dialog" style="padding:10px;position:absolute;">
<request-form :showing="dlgShow" :isEdit="isEditing" :rowData="rowData" @close="onDlgClose">
</request-form>
</div>
<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-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>
</div>
<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>
</div>
</div>
<div class="row">
<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'>
<e-columns>
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=60 :isPrimaryKey='true'></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='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='Priority' headerText='Priority' :filter='filter' width=70></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 headerText='' width='60' :commands='commands' textAlign='left'></e-column>
<e-column headerText='' width='150' :commands='labelCommands' textAlign='left' ></e-column>
</e-columns>
</ejs-grid>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue'
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import RequestForm from '@/components/RequestForm'
import { requestData, employeeData } from '../datasource.js'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
import { Browser } from '@syncfusion/ej2-base'
Vue.use(DateRangePickerPlugin)
Vue.use(GridPlugin)
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
export default Vue.extend({
data: function () {
return {
dlgShow: 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 = grid.selectedRowIndex
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
}
})
</script>
<style>
#primarybtn{
/* display: block !important; */
margin-right:20px;
}
.datepicker-panel{
float: right;
margin-right:20px;
}
.datepicker-panel-group{
display: flex;
}
.content-wrapper {
width: 100%;
margin: 15px auto;
min-width: 185px;
}
@media only screen and (max-width: 480px) {
.content-wrapper {
width: 92%;
}
}
.e-flat .e-approve {
padding: 2px 10px !important;
}
.e-approve, .e-reject {
background-color: #E2E4E8 !important;
font-size: 13px !important;
color: #4C4C4C !important;
}
.e-approve:hover, .e-reject:hover {
background-color: #D1D4DB !important;
}
.e-approve:focus, .e-reject:focus {
background-color: #B4B8C0 !important;
}
.e-grid .e-rowcell.e-unboundcell.row-approve {
background-image: url('../assets/Approve.svg');
background-repeat: no-repeat;
background-position-y: center;
}
.row-approve::after {
padding-left: 20px;
content: 'Approved';
color: #0BB60E;
font-weight: 600;
font-size: 13px;
}
.e-grid .e-rowcell.e-unboundcell.row-reject {
background-image: url('../assets/Reject.svg');
background-repeat: no-repeat;
background-position-y: center;
}
.row-reject::after {
padding-left: 20px;
content: 'Rejected';
color: #F64F4C;
font-weight: 600;
font-size: 13px;
}
</style>

Просмотреть файл

@ -0,0 +1,167 @@
<template id="view-hardware">
<div class="container-fluid">
<div id="dialog" style="padding:10px;position:absolute;">
<add-software :showing="dlgShow" :isEdit="isEditing" :rowData="rowData" @close="onDlgClose">
</add-software>
</div>
<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-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>
</div>
<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>
</div>
</div>
<div class="row">
<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'>
<e-columns>
<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='Edition' headerText='Edition' width=80></e-column>
<e-column field='Version' headerText='Version' clipMode='EllipsisWithTooltip' width=100></e-column>
<e-column field='Vendor' headerText='Vendor' clipMode='EllipsisWithTooltip' width=100></e-column>
<e-column field='LicenseType' headerText='Type' :filter='filter' clipMode='EllipsisWithTooltip' width=70></e-column>
<e-column field='LicenseCount' headerText='Licenses' textAlign='Right' editType='numericedit' format='N' width=90></e-column>
<e-column field='DOP' headerText='Purchase Date' textAlign='Right' type='date' editType='datepickeredit' format='yMd' width=130></e-column>
<e-column field='ExpiredOn' headerText='Expiry' textAlign='Right' type='date' editType='datepickeredit' format='yMd' width=90></e-column>
<e-column field='Category' headerText='Category' :filter='filter' clipMode='EllipsisWithTooltip' width=90></e-column>
<e-column field='Note' headerText='Notes' :visible='false'></e-column>
<e-column headerText='' width='100' :commands='commands'></e-column>
</e-columns>
</ejs-grid>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue'
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import AddSoftware from '@/components/AddSoftware'
import { softwareData } from '../datasource.js'
import { Browser } from '@syncfusion/ej2-base'
Vue.use(DateRangePickerPlugin)
Vue.use(GridPlugin)
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
export default Vue.extend({
data: function () {
return {
dlgShow: 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
}
})
</script>
<style scoped>
#primarybtn{
/* display: block !important; */
margin-right:20px;
}
.datepicker-panel{
float: right;
margin-right:20px;
}
.datepicker-panel-group{
display: flex;
}
.content-wrapper {
width: 100%;
margin: 15px auto;
min-width: 185px;
}
@media only screen and (max-width: 480px) {
.content-wrapper {
width: 92%;
}
}
</style>

Просмотреть файл

@ -0,0 +1,317 @@
<template>
<div class="container-fluid">
<div class="row top-row">
<div class="col-lg-8 col-md-8">
<h3>Dashboard</h3>
</div>
<!-- </div>
<div class="row"> -->
<div class="col-lg-2 col-md-2 dashboard-card">
<div tabindex="0" class="e-card" id="card-request" @click="requestClick($event)">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">{{this.$store.getters.requests}}</div>
<div class="e-card-sub-title">Requests Processed</div>
</div>
</div>
</div>
</div>
<div class="col-lg-2 col-md-2 dashboard-card">
<div tabindex="0" class="e-card" id="card-license" @click="licenseClick($event)">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">{{this.$store.getters.licenses}}</div>
<div class="e-card-sub-title">Licenses Issued</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<!-- <div class="col-lg-12 "> -->
<div class="col-lg-8">
<div class="row">
<div class="col-lg-6 chart-area">
<div id='chart01'>
<div class='innerChart'>
<hardware-status-chart id='chart1'></hardware-status-chart>
</div>
</div>
</div>
<div class="empty-col"></div>
<div class="col-lg-6 chart-area">
<div id='chart02'>
<div class='innerChart'>
<hardware-category-chart id='chart2'></hardware-category-chart>
</div>
</div>
</div>
</div>
<div class="row col-lg-8 empty-row">
</div>
<div class="row">
<div class="col-lg-6 chart-area">
<div id='chart03'>
<div class='innerChart'>
<software-license-chart id='chart3'></software-license-chart>
</div>
</div>
</div>
<div class="empty-col"></div>
<div class="col-lg-6 chart-area">
<div id='chart04'>
<div class='innerChart'>
<software-category-chart id='chart4'></software-category-chart>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 list-surface">
<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>
</div>
</div>
<!-- </div> -->
</div>
</div>
</template>
<script>
import Vue from 'vue'
import { ListViewPlugin } from '@syncfusion/ej2-vue-lists'
import ActivityTemplate from './ActivityTemplate.vue'
import SoftwareLicenseChart from '@/components/dashboard/SoftwareLicenseChart'
import HardwareStatusChart from '@/components/dashboard/HardwareStatusChart'
import HardwareCategoryChart from '@/components/dashboard/HardwareCategoryChart'
import SoftwareCategoryChart from '@/components/dashboard/SoftwareCategoryChart'
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>
<style>
.dashboard-card {
padding-left: 10px;
padding-right: 10px;
}
#card-request,
#card-license {
height: 80px;
margin-bottom: 10px;
text-align: center;
box-shadow: 0px 2px 8px #7b77885e;
border: none;
cursor: pointer;
}
#card-request {
background-color: #B991DA;
}
#card-request:hover {
background-color: #946DB4;
}
#card-license {
background-color: #60D6A2;
}
#card-license:hover {
background-color: #4DAE83;
}
.e-card-header-title {
color: #FFFFFF !important;
font-size: 26px !important;
font-family: Roboto;
font-weight: '1000';
}
.e-card-sub-title {
color: #FFFFFF !important;
font-family: Roboto;
font-size: 14px !important;
}
.chart-area {
height: 296px;
padding: 10px 10px;
}
#chart01,
#chart02,
#chart03,
#chart04 {
height: 296px;
border-radius: 4px;
box-shadow: 0px 2px 8px #7b77885e;
background: #fff;
}
#chart001,
#chart002,
#chart003,
#chart004 {
height: 250px !important;
}
.list-area {
border-radius: 4px;
box-shadow: 0px 2px 8px #7b77885e;
height: 612px;
overflow: auto;
background: #fff;
margin-top: 10px;
}
.row.col-lg-8.empty-row {
padding: 10px;
}
@media screen and (min-width: 1366px){
.chart-area {
height: 296px;
padding: 10px 10px;
}
#chart01,
#chart02,
#chart03,
#chart04 {
height: 296px;
border-radius: 4px;
box-shadow: 0px 2px 8px #7b77885e;
background: #fff;
}
#chart001,
#chart002,
#chart003,
#chart004 {
height: 250px !important;
}
.list-area {
border-radius: 4px;
box-shadow: 0px 2px 8px #7b77885e;
height: 612px;
overflow: auto;
background: #fff;
margin-top: 10px;
}
}
@media screen and (min-width: 1600px){
.chart-area {
height: 350px;
padding: 10px 10px;
}
#chart01,
#chart02,
#chart03,
#chart04 {
height: 350px;
border-radius: 4px;
box-shadow: 0px 2px 8px #7b77885e;
background: #fff;
}
#chart001,
#chart002,
#chart003,
#chart004 {
height: 300px !important;
}
.list-area {
border-radius: 4px;
box-shadow: 0px 2px 8px #7b77885e;
height: 720px;
overflow: auto;
background: #fff;
margin-top: 10px;
}
}
@media screen and (min-width: 1900px){
.chart-area {
height: 370px;
padding: 10px 10px;
}
#chart01,
#chart02,
#chart03,
#chart04 {
height: 370px;
border-radius: 4px;
box-shadow: 0px 2px 8px #7b77885e;
background: #fff;
}
#chart001,
#chart002,
#chart003,
#chart004 {
height: 320px !important;
}
.list-area {
border-radius: 4px;
box-shadow: 0px 2px 8px #7b77885e;
height: 760px;
overflow: auto;
background: #fff;
margin-top: 10px;
}
}
@media screen and (max-width: 450px){
.chart-area{
margin-bottom: 20px;
}
.empty-row{
padding: 0px !important;
}
}
#chart-title {
font-size: 14px;
font-family: Helvetica, 'Segoe UI', Tahoma, Geneva, Verdana, Arial;
color: #323C47;
padding-top: 16px;
padding-left: 10px;
margin: 0 0 5px !important;
}
.list-surface {
padding-left: 10px;
padding-right: 10px;
}
#listview_template.e-listview .e-list-item {
padding: 10px;
/* height: 65px; */
line-height: 15px !important;
}
#listview_template.e-listview .e-list-header {
margin-bottom: 15px;
color: #323C47;
font-family: helvetica;
font-weight: 600 !important;
height: 50px !important;
}
#listview_template.e-listview .e-list-item {
height: auto !important;
}
</style>

Просмотреть файл

@ -1,58 +0,0 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

Просмотреть файл

@ -0,0 +1,256 @@
<template>
<ejs-dialog ref="dialogObj" :isModal='isModal' id="dialog" v-bind:visible="isShowing" :header='header' :animationSettings='animationSettings' :allowDragging='true' :showCloseIcon='showCloseIcon' :target='target' :width='width' :open="dialogOpen" :close="dialogClose">
<form id="formId" class="dlg-form" novalidate="">
<div class="col-lg-12 e-input-section">
<div class="content-wrapper">
<div class="row" v-show="isEdit">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Task ID</label>
<input id="taskID" class="e-input" type="text" disabled>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
<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>
<div id="errorEmp"></div>
</div>
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
<label class="e-text">Software</label>
<ejs-dropdownlist id="software" name="Name" :dataSource ="this.$store.getters.softwareNames" :fields='softwareFields'></ejs-dropdownlist>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
<label class="e-text">No. Of Available Licenses</label>
<input id="license-count" class="e-input" type="text" disabled>
</div>
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
<label class="e-text">License Key</label>
<input id="license-key" name="License" class="e-input" type="text">
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
<label class="e-text">Issued On</label>
<ejs-datepicker class="e-input" id="issue-date" data-msg-containerid="errorID" name="DOI" :max="maxDate"></ejs-datepicker>
<div id="errorID"></div>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-lg-12 col-md-12">
<label class="e-text">Note</label>
<textarea class="e-input" rows="4" id="note"></textarea>
</div>
</div>
<div class="row pull-right">
<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>
</div>
</div>
</div>
</div>
</form>
</ejs-dialog>
</template>
<script>
import Vue from 'vue'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import { FormValidator } from '@syncfusion/ej2-vue-inputs'
import { employeeData } from '../datasource.js'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
export default Vue.extend({
data: function () {
return {
fields: {value: 'Employee'},
softwareFields: { text: 'Name', value: 'TaskID' },
header: 'Issue License',
target: document.body,
showCloseIcon: true,
width: '500px',
btnName: 'Submit',
isModal: true,
maxDate: new Date(),
options: {
// Initialize the CustomPlacement.
customPlacement: function (inputElement, errorElement) {
inputElement.parentElement.nextElementSibling.appendChild(errorElement)
},
rules: {
Emp: { required: true },
DOI: { required: true, date: true }
}
},
frmObj: undefined,
value: null,
animationSettings: { effect: 'None' }
}
},
mounted: function () {
this.frmObj = new FormValidator('#formId', this.options)
},
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
}
}
})
</script>
<style scoped>
.content-wrapper {
width: 100%;
margin: 0 auto;
min-width: 185px;
}
.content-wrapper div.row {
padding: 5px 0px;
}
.control-label {
padding: 24px 0px 0px 0px;
font-size: 12px;
opacity: 0.54;
}
@media only screen and (max-width: 480px) {
.content-wrapper {
width: 92%;
}
.e-input-section .col-xs-6,
.e-input-section .col-xs-4,
.e-input-section .col-xs-12 {
padding: 10px 5px;
width: 100%;
}
.content-wrapper div.row {
padding: 0px;
}
#dialog {
top: 10px;
/* height: 100%; */
}
}
</style>

Просмотреть файл

@ -0,0 +1,58 @@
<template>
<ejs-sidebar id="sidebar-notification" :type='type' ref="notifybarInstance" :showBackdrop='showBackdrop' :enableDock='enableDock' :width='width' :position="position" :target="sidebarTarget">
<ejs-listview id='listview_notification' :fields='fields' ref='list_notification' :dataSource='data' :showHeader='header' :headerTitle='listTitle' :template='ltemplate' :select='onComplete'></ejs-listview>
</ejs-sidebar>
</template>
<script>
import Vue from 'vue'
import { ListViewPlugin } from '@syncfusion/ej2-vue-lists'
import ActivityTemplate from './ActivityTemplate.vue'
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}
},
fields: { 'id': 'Employee' },
listTitle: 'Notifications',
type: 'Over',
width: '300px',
enableDock: false,
closeOnDocumentClick: true,
showBackdrop: false,
sidebarTarget: navigator.userAgent.indexOf('Firefox') !== -1 ? 'body' : '.content',
position: 'Right'
}
},
methods: {
toggle: function () {
this.$refs.list_notification.ej2Instances.reRender()
this.$refs.notifybarInstance.toggle()
},
hide: function () {
this.$refs.notifybarInstance.hide()
},
onComplete: function () {
}
}
})
</script>
<style>
#listview_notification.e-listview .e-list-item {
padding: 10px;
line-height: 15px !important;
}
#listview_notification.e-listview .e-list-header {
margin-bottom: 15px;
height: 50px !important;
}
#listview_notification.e-listview .e-list-item {
height: auto !important;
}
</style>

Просмотреть файл

@ -0,0 +1,299 @@
<template>
<ejs-dialog ref="dialogObj" id="dialog" :isModal='isModal' v-bind:visible="isShowing" :header='header' :animationSettings='animationSettings' :allowDragging='true' :showCloseIcon='showCloseIcon' :target='target' :width='width' :open="dialogOpen" :close="dialogClose">
<form id="formId" class="dlg-form" novalidate="">
<div class="col-lg-12 e-input-section">
<div class="content-wrapper">
<div class="row" v-show="isEdit">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Task ID</label>
<input id="taskID" class="e-input" type="text" disabled>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<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>
<div id="errorEmp"></div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Request Type</label>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<ejs-radiobutton label="Hardware" id="HardwareRB" name="type" value="Hardware" checked="true" @change="getType" ></ejs-radiobutton>
<ejs-radiobutton label="Software" id="SoftwareRB" name="type" value="Software" @change="getType"></ejs-radiobutton>
</div>
<div v-show="isHardware">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Hardware</label>
<ejs-dropdownlist id="Hardware" name="Hardware" :dataSource ="this.$store.getters.hardwareNames" :fields='hardwareFields'></ejs-dropdownlist>
</div>
</div>
<div v-show="!isHardware">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Software</label>
<ejs-dropdownlist id="Software" name="Software" :dataSource ="this.$store.getters.softwareNames" :fields='softwareFields'></ejs-dropdownlist>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Requested On</label>
<ejs-datepicker id="requested-on" name="DOR" data-msg-containerid="errorID" class="e-input" :max="maxDate" required></ejs-datepicker>
<div id="errorID"></div>
</div>
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Priority</label>
<ejs-dropdownlist id="priority" name="Priority" :dataSource ="priortyList"></ejs-dropdownlist>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-lg-12 col-md-12">
<label class="e-text">Note</label>
<textarea id="note" class="e-input" rows="4"></textarea>
</div>
</div>
<div class="row pull-right">
<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>
</div>
</div>
</div>
</div>
</form>
</ejs-dialog>
</template>
<script>
import Vue from 'vue'
import { ButtonPlugin, RadioButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent, AutoCompletePlugin } from '@syncfusion/ej2-vue-dropdowns'
import { DialogPlugin } from '@syncfusion/ej2-vue-popups'
import { employeeData } from '../datasource.js'
import { FormValidator } from '@syncfusion/ej2-vue-inputs'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
Vue.use(DialogPlugin)
Vue.use(RadioButtonPlugin)
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.component(ButtonPlugin)
Vue.use(AutoCompletePlugin)
export default Vue.extend({
data: function () {
return {
priortyList: [
{ id: 'stat-1', text: 'Low' },
{ id: 'stat-2', text: 'Normal' },
{ id: 'stat-3', text: 'High' },
{ id: 'stat-4', text: 'Critical' }
],
softwareFields: { text: 'Name', value: 'TaskID' },
hardwareFields: { text: 'Name', value: 'TaskID' },
selectedType: 'Hardware',
isHardware: true,
header: 'Request Form',
target: document.body,
showCloseIcon: true,
btnName: 'Submit Request',
width: '500px',
isModal: true,
fields: {value: 'Employee'},
query: new Query().select(['id', 'Employee']),
enableDate: true,
maxDate: new Date(),
options: {
// 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: {
selectedType: function (newType) {
this.$dispatch('selectedType', newType)
}
},
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
}
}
})
</script>
<style scoped>
.content-wrapper {
width: 100%;
margin: 0 auto;
min-width: 185px;
}
.content-wrapper div.row {
padding: 5px 0px;
}
.control-label {
padding: 24px 0px 0px 0px;
font-size: 12px;
opacity: 0.54;
}
@media only screen and (max-width: 480px) {
.content-wrapper {
width: 92%;
}
.e-input-section .col-xs-6,
.e-input-section .col-xs-4,
.e-input-section .col-xs-12 {
padding: 10px 5px;
width: 100%;
}
.content-wrapper div.row {
padding: 0px;
}
#dialog {
top: 10px;
/* height: 100%; */
}
}
</style>

Просмотреть файл

@ -0,0 +1,66 @@
<template>
<div>
<p id="chart-title">Statistics by Hardware Category</p>
<ejs-chart style='display:block' align='center' id='chart002' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'
:chartArea='chartArea' :tooltip='tooltip'>
<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='this.$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='this.$store.getters.miscData' :query='miscQuery' type='Column' xName='key' yName='count' name='Miscellaneous' :marker='marker' fill='#D075C6'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import Vue from 'vue'
import { ChartPlugin, ColumnSeries, Category, DataLabel, Tooltip, Legend } from '@syncfusion/ej2-vue-charts'
import { Query } from '@syncfusion/ej2-data'
Vue.use(ChartPlugin)
export default Vue.extend({
data: function () {
return {
laptopQuery: new Query().take(this.$store.getters.laptopData.length),
monitorQuery: new Query().take(this.$store.getters.monitorData.length),
tabletQuery: new Query().take(this.$store.getters.tabletData.length),
miscQuery: new Query().take(this.$store.getters.miscData.length),
// Initializing Primary X Axis
primaryXAxis: {
valueType: 'Category', interval: 0, majorGridLines: { width: 0 }
},
chartArea: { border: { width: 0 } },
// Initializing Primary Y Axis
primaryYAxis:
{
minimum: 0,
maximum: 8,
interval: 10,
majorGridLines: { width: 0 },
majorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelStyle: { color: 'transparent' }
},
theme: 'Fabric',
width: '100%',
marker:
{ dataLabel:
{ visible: true, position: 'Top', font: { fontWeight: '600' }
}
},
tooltip: {
enable: true
},
title: 'Statistics by Hardware Category',
enableSmartLabels: true
}
},
provide: {
chart: [ColumnSeries, Legend, DataLabel, Category, Tooltip]
}
})
</script>
<style scoped>
</style>

Просмотреть файл

@ -0,0 +1,53 @@
<template>
<div>
<p id="chart-title">Statistics by Hardware Status</p>
<ejs-accumulationchart ref='hardware-pie' :theme='theme' style='display:block' align='center' id='chart001'
:legendSettings='legendSettings' :tooltip='tooltip' enableSmartLables='true'>
<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-collection>
</ejs-accumulationchart>
</div>
</template>
<script>
import Vue from 'vue'
import { AccumulationChartPlugin, AccumulationTooltip, PieSeries, AccumulationDataLabel, AccumulationLegend } from '@syncfusion/ej2-vue-charts'
import { Query } from '@syncfusion/ej2-data'
Vue.use(AccumulationChartPlugin)
export default Vue.extend({
data: function () {
return {
theme: 'Fabric',
queries: new Query().take(this.$store.getters.hardwareStatus.length),
title: 'Statistics by Hardware Status',
enableSmartLabels: true,
legendSettings: {
visible: true,
position: 'Bottom'
},
tooltip: { enable: true },
startAngle: '0',
endAngle: '360',
radius: '90%',
explodeOffset: '5%',
explodeIndex: 0,
colors: ['#7F9FD2', '#81B8B3', '#7FD29F', '#AEEB8E'],
dataLabel: {
visible: true,
position: 'Inside',
name: 'text',
font: {
fontWeight: '600'
}
}
}
},
provide: {
accumulationchart: [AccumulationLegend, PieSeries, AccumulationTooltip, AccumulationDataLabel]
}
})
</script>
<style scoped>
</style>

Просмотреть файл

@ -0,0 +1,53 @@
<template>
<div>
<p id="chart-title">Statistics by Software Category</p>
<ejs-treemap id='chart004' :leafItemSettings='leafItemSettings'
format='n' :useGroupingSeparator='useGroupingSeparator'
:dataSource='dataSource' :legendSettings='legendSettings' :palette='palette' :tooltipSettings='tooltipSettings'
:weightValuePath='weightValuePath' :levels='levels'>
</ejs-treemap>
</div>
</template>
<script>
import Vue from 'vue'
import { TreeMapPlugin, TreeMapTooltip, TreeMapLegend } from '@syncfusion/ej2-vue-treemap'
Vue.use(TreeMapPlugin)
export default Vue.extend({
data: function () {
return {
useGroupingSeparator: true,
dataSource: this.$store.state.softwareInput,
legendSettings: {
visible: true,
position: 'Bottom',
shape: 'Rectangle',
shapeHeight: 7,
shapeWidth: 7
},
palette: ['#AEEB8E', '#D075C6', '#7E7EDC', '#7EC9DC', '#D6DC7E'],
tooltipSettings: {
visible: true,
// eslint-disable-next-line
format: '${Name}<br>License Count : ${LicenseCount}'
},
leafItemSettings: {
labelPath: 'Name',
border: { color: '#000000', width: 0.5 }
},
weightValuePath: 'LicenseCount',
levels: [
{
groupPath: 'Category', border: 'none' // { color: 'white', width: 0.5 }
}
]
}
},
provide: {
treemap: [TreeMapTooltip, TreeMapLegend]
}
})
</script>
<style scoped>
</style>

Просмотреть файл

@ -0,0 +1,53 @@
<template>
<div>
<p id="chart-title">Statistics by Software License Type</p>
<ejs-accumulationchart ref='software-pie' :theme='theme' style='display:block' align='center' id='chart003'
:legendSettings='legendSettings' :tooltip='tooltip' enableSmartLables='true'>
<e-accumulation-series-collection>
<e-accumulation-series :dataSource='this.$store.getters.softwareLicense' :query='queries' xName='key' yName='count' :dataLabel='dataLabel' :startAngle='startAngle' :endAngle='endAngle' :explodeOffset='explodeOffset' :explodeIndex='explodeIndex' :radius='radius' name='Software License' innerRadius='0%' explode='true' width=2 :palettes="colors"> </e-accumulation-series>
</e-accumulation-series-collection>
</ejs-accumulationchart>
</div>
</template>
<script>
import Vue from 'vue'
import { AccumulationChartPlugin, AccumulationTooltip, PieSeries, AccumulationDataLabel, AccumulationLegend } from '@syncfusion/ej2-vue-charts'
import { Query } from '@syncfusion/ej2-data'
Vue.use(AccumulationChartPlugin)
export default Vue.extend({
data: function () {
return {
theme: 'Fabric',
queries: new Query().take(this.$store.getters.softwareLicense.length),
title: 'Statistics by Software License Type',
enableSmartLabels: true,
legendSettings: {
visible: true,
position: 'Bottom'
},
tooltip: { enable: true },
startAngle: '0',
endAngle: '360',
radius: '90%',
explodeOffset: '5%',
explodeIndex: 0,
colors: ['#FDC288', '#A483D5', '#CB85AA'],
dataLabel: {
visible: true,
position: 'Inside',
name: 'text',
font: {
fontWeight: '600'
}
}
}
},
provide: {
accumulationchart: [AccumulationLegend, PieSeries, AccumulationTooltip, AccumulationDataLabel]
}
})
</script>
<style scoped>
</style>

1474
src/datasource.js Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

70
src/router/index.js Normal file
Просмотреть файл

@ -0,0 +1,70 @@
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
}
]
})

82
src/store/index.js Normal file
Просмотреть файл

@ -0,0 +1,82 @@
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))
}
})
}
}
})