Clean up code formatting

This commit is contained in:
Jonathan Reinink 2021-02-27 09:00:09 -05:00
parent f3b8bba02b
commit 5dab72d894
21 changed files with 1519 additions and 1338 deletions

39
.eslintrc.js vendored
View File

@ -1,15 +1,32 @@
module.exports = { module.exports = {
extends: [ extends: ['eslint:recommended', 'plugin:vue/recommended'],
'eslint:recommended', parserOptions: {
'plugin:vue/recommended', ecmaVersion: 2020,
], sourceType: 'module',
},
env: {
amd: true,
browser: true,
es6: true,
},
rules: { rules: {
"indent": ['error', 2], indent: ['error', 2],
'quotes': ['warn', 'single'], quotes: ['warn', 'single'],
'semi': ['warn', 'never'], semi: ['warn', 'never'],
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
'comma-dangle': ['warn', 'always-multiline'], 'comma-dangle': ['warn', 'always-multiline'],
'vue/max-attributes-per-line': false, 'vue/max-attributes-per-line': 'off',
'vue/require-default-prop': false, 'vue/require-default-prop': 'off',
'vue/singleline-html-element-content-newline': false, 'vue/singleline-html-element-content-newline': 'off',
} 'vue/html-self-closing': [
'warn',
{
html: {
void: 'always',
normal: 'always',
component: 'always',
},
},
],
},
} }

8
.prettierrc Normal file
View File

@ -0,0 +1,8 @@
{
"printWidth": 10000,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"htmlWhitespaceSensitivity": "css"
}

2689
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,16 +15,16 @@
"@inertiajs/inertia-vue": "^0.5.5", "@inertiajs/inertia-vue": "^0.5.5",
"@inertiajs/progress": "^0.2.4", "@inertiajs/progress": "^0.2.4",
"cross-env": "^5.2.1", "cross-env": "^5.2.1",
"eslint": "^5.16.0", "eslint": "^6.8.0",
"eslint-plugin-vue": "^5.2.3", "eslint-plugin-vue": "^7.5.0",
"laravel-mix": "^5.0.1", "laravel-mix": "^5.0.9",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"popper.js": "^1.16.0", "popper.js": "^1.16.0",
"portal-vue": "^1.5.1", "portal-vue": "^1.5.1",
"postcss-import": "^12.0.1", "postcss-import": "^12.0.1",
"postcss-nesting": "^7.0.1", "postcss-nesting": "^7.0.1",
"resolve-url-loader": "^2.3.2", "resolve-url-loader": "^2.3.2",
"tailwindcss": "^1.2.0-canary.5", "tailwindcss": "^1.9.6",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-meta": "^2.3.1", "vue-meta": "^2.3.1",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"

View File

@ -9,7 +9,7 @@
<text-input v-model="form.email" :error="form.errors.email" class="mt-10" label="Email" type="email" autofocus autocapitalize="off" /> <text-input v-model="form.email" :error="form.errors.email" class="mt-10" label="Email" type="email" autofocus autocapitalize="off" />
<text-input v-model="form.password" :error="form.errors.password" class="mt-6" label="Password" type="password" /> <text-input v-model="form.password" :error="form.errors.password" class="mt-6" label="Password" type="password" />
<label class="mt-6 select-none flex items-center" for="remember"> <label class="mt-6 select-none flex items-center" for="remember">
<input id="remember" v-model="form.remember" class="mr-1" type="checkbox"> <input id="remember" v-model="form.remember" class="mr-1" type="checkbox" />
<span class="text-sm">Remember Me</span> <span class="text-sm">Remember Me</span>
</label> </label>
</div> </div>
@ -23,9 +23,9 @@
</template> </template>
<script> <script>
import LoadingButton from '@/Shared/LoadingButton'
import Logo from '@/Shared/Logo' import Logo from '@/Shared/Logo'
import TextInput from '@/Shared/TextInput' import TextInput from '@/Shared/TextInput'
import LoadingButton from '@/Shared/LoadingButton'
export default { export default {
metaInfo: { title: 'Login' }, metaInfo: { title: 'Login' },

View File

@ -35,18 +35,18 @@
<script> <script>
import Layout from '@/Shared/Layout' import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
import TextInput from '@/Shared/TextInput' import TextInput from '@/Shared/TextInput'
import SelectInput from '@/Shared/SelectInput'
import LoadingButton from '@/Shared/LoadingButton'
export default { export default {
metaInfo: { title: 'Create Contact' }, metaInfo: { title: 'Create Contact' },
layout: Layout,
components: { components: {
LoadingButton, LoadingButton,
SelectInput, SelectInput,
TextInput, TextInput,
}, },
layout: Layout,
props: { props: {
organizations: Array, organizations: Array,
}, },

View File

@ -40,9 +40,9 @@
<script> <script>
import Layout from '@/Shared/Layout' import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
import TextInput from '@/Shared/TextInput' import TextInput from '@/Shared/TextInput'
import SelectInput from '@/Shared/SelectInput'
import LoadingButton from '@/Shared/LoadingButton'
import TrashedMessage from '@/Shared/TrashedMessage' import TrashedMessage from '@/Shared/TrashedMessage'
export default { export default {
@ -51,13 +51,13 @@ export default {
title: `${this.form.first_name} ${this.form.last_name}`, title: `${this.form.first_name} ${this.form.last_name}`,
} }
}, },
layout: Layout,
components: { components: {
LoadingButton, LoadingButton,
SelectInput, SelectInput,
TextInput, TextInput,
TrashedMessage, TrashedMessage,
}, },
layout: Layout,
props: { props: {
errors: Object, errors: Object,
contact: Object, contact: Object,

View File

@ -64,21 +64,21 @@
<script> <script>
import Icon from '@/Shared/Icon' import Icon from '@/Shared/Icon'
import pickBy from 'lodash/pickBy'
import Layout from '@/Shared/Layout' import Layout from '@/Shared/Layout'
import throttle from 'lodash/throttle'
import mapValues from 'lodash/mapValues' import mapValues from 'lodash/mapValues'
import Pagination from '@/Shared/Pagination' import Pagination from '@/Shared/Pagination'
import pickBy from 'lodash/pickBy'
import SearchFilter from '@/Shared/SearchFilter' import SearchFilter from '@/Shared/SearchFilter'
import throttle from 'lodash/throttle'
export default { export default {
metaInfo: { title: 'Contacts' }, metaInfo: { title: 'Contacts' },
layout: Layout,
components: { components: {
Icon, Icon,
Pagination, Pagination,
SearchFilter, SearchFilter,
}, },
layout: Layout,
props: { props: {
contacts: Object, contacts: Object,
filters: Object, filters: Object,

View File

@ -30,18 +30,18 @@
<script> <script>
import Layout from '@/Shared/Layout' import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
import TextInput from '@/Shared/TextInput' import TextInput from '@/Shared/TextInput'
import SelectInput from '@/Shared/SelectInput'
import LoadingButton from '@/Shared/LoadingButton'
export default { export default {
metaInfo: { title: 'Create Organization' }, metaInfo: { title: 'Create Organization' },
layout: Layout,
components: { components: {
LoadingButton, LoadingButton,
SelectInput, SelectInput,
TextInput, TextInput,
}, },
layout: Layout,
remember: 'form', remember: 'form',
data() { data() {
return { return {

View File

@ -72,16 +72,15 @@
<script> <script>
import Icon from '@/Shared/Icon' import Icon from '@/Shared/Icon'
import Layout from '@/Shared/Layout' import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
import TextInput from '@/Shared/TextInput' import TextInput from '@/Shared/TextInput'
import SelectInput from '@/Shared/SelectInput'
import LoadingButton from '@/Shared/LoadingButton'
import TrashedMessage from '@/Shared/TrashedMessage' import TrashedMessage from '@/Shared/TrashedMessage'
export default { export default {
metaInfo() { metaInfo() {
return { title: this.form.name } return { title: this.form.name }
}, },
layout: Layout,
components: { components: {
Icon, Icon,
LoadingButton, LoadingButton,
@ -89,6 +88,7 @@ export default {
TextInput, TextInput,
TrashedMessage, TrashedMessage,
}, },
layout: Layout,
props: { props: {
organization: Object, organization: Object,
}, },

View File

@ -56,21 +56,21 @@
<script> <script>
import Icon from '@/Shared/Icon' import Icon from '@/Shared/Icon'
import pickBy from 'lodash/pickBy'
import Layout from '@/Shared/Layout' import Layout from '@/Shared/Layout'
import throttle from 'lodash/throttle'
import mapValues from 'lodash/mapValues' import mapValues from 'lodash/mapValues'
import Pagination from '@/Shared/Pagination' import Pagination from '@/Shared/Pagination'
import pickBy from 'lodash/pickBy'
import SearchFilter from '@/Shared/SearchFilter' import SearchFilter from '@/Shared/SearchFilter'
import throttle from 'lodash/throttle'
export default { export default {
metaInfo: { title: 'Organizations' }, metaInfo: { title: 'Organizations' },
layout: Layout,
components: { components: {
Icon, Icon,
Pagination, Pagination,
SearchFilter, SearchFilter,
}, },
layout: Layout,
props: { props: {
organizations: Object, organizations: Object,
filters: Object, filters: Object,

View File

@ -27,20 +27,20 @@
<script> <script>
import Layout from '@/Shared/Layout' import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
import TextInput from '@/Shared/TextInput'
import FileInput from '@/Shared/FileInput' import FileInput from '@/Shared/FileInput'
import TextInput from '@/Shared/TextInput'
import SelectInput from '@/Shared/SelectInput'
import LoadingButton from '@/Shared/LoadingButton'
export default { export default {
metaInfo: { title: 'Create User' }, metaInfo: { title: 'Create User' },
layout: Layout,
components: { components: {
FileInput,
LoadingButton, LoadingButton,
SelectInput, SelectInput,
TextInput, TextInput,
FileInput,
}, },
layout: Layout,
remember: 'form', remember: 'form',
data() { data() {
return { return {

View File

@ -6,7 +6,7 @@
<span class="text-indigo-400 font-medium">/</span> <span class="text-indigo-400 font-medium">/</span>
{{ form.first_name }} {{ form.last_name }} {{ form.first_name }} {{ form.last_name }}
</h1> </h1>
<img v-if="user.photo" class="block w-8 h-8 rounded-full ml-4" :src="user.photo"> <img v-if="user.photo" class="block w-8 h-8 rounded-full ml-4" :src="user.photo" />
</div> </div>
<trashed-message v-if="user.deleted_at" class="mb-6" @restore="restore"> <trashed-message v-if="user.deleted_at" class="mb-6" @restore="restore">
This user has been deleted. This user has been deleted.
@ -35,10 +35,10 @@
<script> <script>
import Layout from '@/Shared/Layout' import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
import TextInput from '@/Shared/TextInput' import TextInput from '@/Shared/TextInput'
import FileInput from '@/Shared/FileInput' import FileInput from '@/Shared/FileInput'
import SelectInput from '@/Shared/SelectInput'
import LoadingButton from '@/Shared/LoadingButton'
import TrashedMessage from '@/Shared/TrashedMessage' import TrashedMessage from '@/Shared/TrashedMessage'
export default { export default {
@ -47,14 +47,14 @@ export default {
title: `${this.form.first_name} ${this.form.last_name}`, title: `${this.form.first_name} ${this.form.last_name}`,
} }
}, },
layout: Layout,
components: { components: {
FileInput,
LoadingButton, LoadingButton,
SelectInput, SelectInput,
TextInput, TextInput,
FileInput,
TrashedMessage, TrashedMessage,
}, },
layout: Layout,
props: { props: {
user: Object, user: Object,
}, },

View File

@ -31,7 +31,7 @@
<tr v-for="user in users" :key="user.id" class="hover:bg-gray-100 focus-within:bg-gray-100"> <tr v-for="user in users" :key="user.id" class="hover:bg-gray-100 focus-within:bg-gray-100">
<td class="border-t"> <td class="border-t">
<inertia-link class="px-6 py-4 flex items-center focus:text-indigo-500" :href="route('users.edit', user.id)"> <inertia-link class="px-6 py-4 flex items-center focus:text-indigo-500" :href="route('users.edit', user.id)">
<img v-if="user.photo" class="block w-5 h-5 rounded-full mr-2 -my-2" :src="user.photo"> <img v-if="user.photo" class="block w-5 h-5 rounded-full mr-2 -my-2" :src="user.photo" />
{{ user.name }} {{ user.name }}
<icon v-if="user.deleted_at" name="trash" class="flex-shrink-0 w-3 h-3 fill-gray-400 ml-2" /> <icon v-if="user.deleted_at" name="trash" class="flex-shrink-0 w-3 h-3 fill-gray-400 ml-2" />
</inertia-link> </inertia-link>
@ -62,19 +62,19 @@
<script> <script>
import Icon from '@/Shared/Icon' import Icon from '@/Shared/Icon'
import Layout from '@/Shared/Layout'
import mapValues from 'lodash/mapValues'
import pickBy from 'lodash/pickBy' import pickBy from 'lodash/pickBy'
import SearchFilter from '@/Shared/SearchFilter' import Layout from '@/Shared/Layout'
import throttle from 'lodash/throttle' import throttle from 'lodash/throttle'
import mapValues from 'lodash/mapValues'
import SearchFilter from '@/Shared/SearchFilter'
export default { export default {
metaInfo: { title: 'Users' }, metaInfo: { title: 'Users' },
layout: Layout,
components: { components: {
Icon, Icon,
SearchFilter, SearchFilter,
}, },
layout: Layout,
props: { props: {
users: Array, users: Array,
filters: Object, filters: Object,

View File

@ -52,7 +52,7 @@ export default {
}, },
}, },
mounted() { mounted() {
document.addEventListener('keydown', (e) => { document.addEventListener('keydown', e => {
if (e.keyCode === 27) { if (e.keyCode === 27) {
this.show = false this.show = false
} }

View File

@ -2,14 +2,16 @@
<div> <div>
<label v-if="label" class="form-label">{{ label }}:</label> <label v-if="label" class="form-label">{{ label }}:</label>
<div class="form-input p-0" :class="{ error: errors.length }"> <div class="form-input p-0" :class="{ error: errors.length }">
<input ref="file" type="file" :accept="accept" class="hidden" @change="change"> <input ref="file" type="file" :accept="accept" class="hidden" @change="change" />
<div v-if="!value" class="p-2"> <div v-if="!value" class="p-2">
<button type="button" class="px-4 py-1 bg-gray-500 hover:bg-gray-700 rounded-sm text-xs font-medium text-white" @click="browse"> <button type="button" class="px-4 py-1 bg-gray-500 hover:bg-gray-700 rounded-sm text-xs font-medium text-white" @click="browse">
Browse Browse
</button> </button>
</div> </div>
<div v-else class="flex items-center justify-between p-2"> <div v-else class="flex items-center justify-between p-2">
<div class="flex-1 pr-1">{{ value.name }} <span class="text-gray-500 text-xs">({{ filesize(value.size) }})</span></div> <div class="flex-1 pr-1">
{{ value.name }} <span class="text-gray-500 text-xs">({{ filesize(value.size) }})</span>
</div>
<button type="button" class="px-4 py-1 bg-gray-500 hover:bg-gray-700 rounded-sm text-xs font-medium text-white" @click="remove"> <button type="button" class="px-4 py-1 bg-gray-500 hover:bg-gray-700 rounded-sm text-xs font-medium text-white" @click="remove">
Remove Remove
</button> </button>

View File

@ -46,11 +46,11 @@
</template> </template>
<script> <script>
import Dropdown from '@/Shared/Dropdown'
import FlashMessages from '@/Shared/FlashMessages'
import Icon from '@/Shared/Icon' import Icon from '@/Shared/Icon'
import Logo from '@/Shared/Logo' import Logo from '@/Shared/Logo'
import Dropdown from '@/Shared/Dropdown'
import MainMenu from '@/Shared/MainMenu' import MainMenu from '@/Shared/MainMenu'
import FlashMessages from '@/Shared/FlashMessages'
export default { export default {
components: { components: {

View File

@ -37,11 +37,9 @@ export default {
methods: { methods: {
isUrl(...urls) { isUrl(...urls) {
let currentUrl = this.$page.url.substr(1) let currentUrl = this.$page.url.substr(1)
if (urls[0] === '') { if (urls[0] === '') {
return currentUrl === '' return currentUrl === ''
} }
return urls.filter(url => currentUrl.startsWith(url)).length return urls.filter(url => currentUrl.startsWith(url)).length
}, },
}, },

View File

@ -12,7 +12,7 @@
<slot /> <slot />
</div> </div>
</dropdown> </dropdown>
<input class="relative w-full px-6 py-3 rounded-r focus:shadow-outline" autocomplete="off" type="text" name="search" placeholder="Search…" :value="value" @input="$emit('input', $event.target.value)"> <input class="relative w-full px-6 py-3 rounded-r focus:shadow-outline" autocomplete="off" type="text" name="search" placeholder="Search…" :value="value" @input="$emit('input', $event.target.value)" />
</div> </div>
<button class="ml-3 text-sm text-gray-500 hover:text-gray-700 focus:text-indigo-500" type="button" @click="$emit('reset')">Reset</button> <button class="ml-3 text-sm text-gray-500 hover:text-gray-700 focus:text-indigo-500" type="button" @click="$emit('reset')">Reset</button>
</div> </div>

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<label v-if="label" class="form-label" :for="id">{{ label }}:</label> <label v-if="label" class="form-label" :for="id">{{ label }}:</label>
<input :id="id" ref="input" v-bind="$attrs" class="form-input" :class="{ error: error }" :type="type" :value="value" @input="$emit('input', $event.target.value)"> <input :id="id" ref="input" v-bind="$attrs" class="form-input" :class="{ error: error }" :type="type" :value="value" @input="$emit('input', $event.target.value)" />
<div v-if="error" class="form-error">{{ error }}</div> <div v-if="error" class="form-error">{{ error }}</div>
</div> </div>
</template> </template>

5
resources/js/app.js vendored
View File

@ -16,9 +16,10 @@ const el = document.getElementById('app')
new Vue({ new Vue({
metaInfo: { metaInfo: {
titleTemplate: (title) => title ? `${title} - Ping CRM` : 'Ping CRM' titleTemplate: title => (title ? `${title} - Ping CRM` : 'Ping CRM'),
}, },
render: h => h(App, { render: h =>
h(App, {
props: { props: {
initialPage: JSON.parse(el.dataset.page), initialPage: JSON.parse(el.dataset.page),
resolveComponent: name => import(`@/Pages/${name}`).then(module => module.default), resolveComponent: name => import(`@/Pages/${name}`).then(module => module.default),