/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');

window.Clipboard = require('clipboard');
require('./notify.min.js');

import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

import App from './views/App'
import Dashboard from './views/Dashboard'
import WorkOrder from './views/WorkOrder'
import Login from './views/Login'
import Home from './views/Welcome'

const router = new VueRouter({
    mode: 'history',
    routes: [
        {
            path: '/',
            name: 'home',
            component: Home
        },
        {
            path: '/login',
            name: 'login',
            component: Login,
        },
        {
            path: '/dashboard',
            name: 'dashboard',
            component: Dashboard,
        },
        {
            path: '/workorders/:id',
            name: 'workorders',
            component: WorkOrder,
            props: true,
        }
    ],
})

const app = new Vue({
    el: '#app',
    components: { App },
    router,
})

$(function () {
    $('[data-toggle="tooltip"]').tooltip()
});

var clipboard = new Clipboard('.btn-clip');

clipboard.on('success', function(e) {
    $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard',  {position:"right", className:'success'});

    e.clearSelection();
});
