Office driver api get data works
This commit is contained in:
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
8
.eslintignore
Normal file
8
.eslintignore
Normal file
@@ -0,0 +1,8 @@
|
||||
/dist
|
||||
/src-capacitor
|
||||
/src-cordova
|
||||
/.quasar
|
||||
/node_modules
|
||||
.eslintrc.cjs
|
||||
/src-ssr
|
||||
/quasar.config.*.temporary.compiled*
|
||||
105
.eslintrc.cjs
Normal file
105
.eslintrc.cjs
Normal file
@@ -0,0 +1,105 @@
|
||||
module.exports = {
|
||||
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
|
||||
// This option interrupts the configuration hierarchy at this file
|
||||
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
|
||||
root: true,
|
||||
|
||||
// https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
|
||||
// Must use parserOptions instead of "parser" to allow vue-eslint-parser to keep working
|
||||
// `parser: 'vue-eslint-parser'` is already included with any 'plugin:vue/**' config and should be omitted
|
||||
parserOptions: {
|
||||
parser: require.resolve('@typescript-eslint/parser'),
|
||||
extraFileExtensions: [ '.vue' ]
|
||||
},
|
||||
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true,
|
||||
node: true,
|
||||
'vue/setup-compiler-macros': true
|
||||
},
|
||||
|
||||
// Rules order is important, please avoid shuffling them
|
||||
extends: [
|
||||
// Base ESLint recommended rules
|
||||
// 'eslint:recommended',
|
||||
|
||||
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#usage
|
||||
// ESLint typescript rules
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
|
||||
// Uncomment any of the lines below to choose desired strictness,
|
||||
// but leave only one uncommented!
|
||||
// See https://eslint.vuejs.org/rules/#available-rules
|
||||
'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention)
|
||||
// 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
|
||||
// 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
|
||||
|
||||
'standard'
|
||||
|
||||
],
|
||||
|
||||
plugins: [
|
||||
// required to apply rules which need type information
|
||||
'@typescript-eslint',
|
||||
|
||||
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
|
||||
// required to lint *.vue files
|
||||
'vue'
|
||||
|
||||
],
|
||||
|
||||
globals: {
|
||||
ga: 'readonly', // Google Analytics
|
||||
cordova: 'readonly',
|
||||
__statics: 'readonly',
|
||||
__QUASAR_SSR__: 'readonly',
|
||||
__QUASAR_SSR_SERVER__: 'readonly',
|
||||
__QUASAR_SSR_CLIENT__: 'readonly',
|
||||
__QUASAR_SSR_PWA__: 'readonly',
|
||||
process: 'readonly',
|
||||
Capacitor: 'readonly',
|
||||
chrome: 'readonly'
|
||||
},
|
||||
|
||||
// add your custom rules here
|
||||
rules: {
|
||||
|
||||
// allow async-await
|
||||
'generator-star-spacing': 'off',
|
||||
// allow paren-less arrow functions
|
||||
'arrow-parens': 'off',
|
||||
'one-var': 'off',
|
||||
'no-void': 'off',
|
||||
'multiline-ternary': 'off',
|
||||
|
||||
'import/first': 'off',
|
||||
'import/namespace': 'error',
|
||||
'import/default': 'error',
|
||||
'import/export': 'error',
|
||||
'import/extensions': 'off',
|
||||
'import/no-unresolved': 'off',
|
||||
'import/no-extraneous-dependencies': 'off',
|
||||
|
||||
// The core 'import/named' rules
|
||||
// does not work with type definitions
|
||||
'import/named': 'off',
|
||||
|
||||
'prefer-promise-reject-errors': 'off',
|
||||
|
||||
quotes: ['warn', 'single', { avoidEscape: true }],
|
||||
|
||||
// this rule, if on, would require explicit return type on the `render` function
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
|
||||
// in plain CommonJS modules, you can't use `import foo = require('foo')` to pass this rule, so it has to be disabled
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
|
||||
// The core 'no-unused-vars' rules (in the eslint:recommended ruleset)
|
||||
// does not work with type definitions
|
||||
'no-unused-vars': 'off',
|
||||
|
||||
// allow debugger during development only
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
|
||||
}
|
||||
}
|
||||
37
.gitignore
vendored
Normal file
37
.gitignore
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
.DS_Store
|
||||
.thumbs.db
|
||||
node_modules
|
||||
|
||||
# Quasar core related directories
|
||||
.quasar
|
||||
/dist
|
||||
/quasar.config.*.temporary.compiled*
|
||||
|
||||
# Cordova related directories and files
|
||||
/src-cordova/node_modules
|
||||
/src-cordova/platforms
|
||||
/src-cordova/plugins
|
||||
/src-cordova/www
|
||||
|
||||
# Capacitor related directories and files
|
||||
/src-capacitor/www
|
||||
/src-capacitor/node_modules
|
||||
|
||||
# BEX related directories and files
|
||||
/src-bex/www
|
||||
/src-bex/js/core
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
|
||||
# local .env files
|
||||
.env.local*
|
||||
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM node:latest
|
||||
|
||||
ENV VITE_BASE_URL="http://localhost:4056"
|
||||
ENV VITE_PAY_URL="http://localhost:4052"
|
||||
ENV VITE_AUTO_URL="http://localhost:4053"
|
||||
RUN mkdir -p /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
ENV PATH /app/node_modules/.bin:$PATH
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY . /app
|
||||
@@ -8,14 +8,13 @@ import { configure } from 'quasar/wrappers'
|
||||
export default configure((/* ctx */) => {
|
||||
return {
|
||||
|
||||
|
||||
eslint: {
|
||||
// fix: true,
|
||||
// include: [],
|
||||
// exclude: [],
|
||||
// cache: false,
|
||||
// rawOptions: {},
|
||||
warnings: true,
|
||||
warnings: false,
|
||||
errors: false
|
||||
},
|
||||
|
||||
|
||||
BIN
src/assets/user_placeholder.png
Normal file
BIN
src/assets/user_placeholder.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 212 KiB |
@@ -2,8 +2,6 @@
|
||||
<q-layout view="lHh Lpr lFf">
|
||||
<q-header elevated>
|
||||
<q-toolbar>
|
||||
|
||||
|
||||
<q-toolbar-title>
|
||||
Auburn Oil
|
||||
</q-toolbar-title>
|
||||
@@ -11,8 +9,6 @@
|
||||
</div>
|
||||
</q-toolbar>
|
||||
</q-header>
|
||||
|
||||
|
||||
<q-page-container>
|
||||
<router-view/>
|
||||
</q-page-container>
|
||||
@@ -20,19 +16,16 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent} from 'vue'
|
||||
import EssentialLink from 'components/EssentialLink.vue'
|
||||
import {useRoute} from 'vue-router' //
|
||||
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MainLayout',
|
||||
|
||||
components: {
|
||||
EssentialLink
|
||||
|
||||
},
|
||||
|
||||
data() {
|
||||
data () {
|
||||
return {
|
||||
leftDrawerOpen: false,
|
||||
|
||||
|
||||
@@ -15,18 +15,14 @@
|
||||
Auburn Oil
|
||||
</q-toolbar-title>
|
||||
<div>
|
||||
<div v-if="user">
|
||||
Welcome {{employee.employee_first_name}} {{employee.employee_last_name}}
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="user.user_id > 0">
|
||||
Welcome {{ employee.employee_first_name }} {{ employee.employee_last_name }}
|
||||
</div>
|
||||
<div v-else>
|
||||
<router-link :to="{ name: 'login' }" class="">
|
||||
<q-btn color="secondary" label="Login"/>
|
||||
</router-link>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<q-btn color="secondary" label="Login"/>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</q-toolbar>
|
||||
</q-header>
|
||||
@@ -42,60 +38,62 @@
|
||||
<q-item-section avatar>
|
||||
<q-icon name="inbox"/>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
Home
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'today' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="inbox"/>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
Todays Deliveries
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'tomorrow' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="drafts"/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
Tomorrow Deliveries
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
<router-link :to="{ name: 'waiting' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="drafts"/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
Waiting Deliveries
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
<router-link :to="{ name: 'stats' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>label
|
||||
<q-item-section avatar>
|
||||
<q-icon name="star"/>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
Stats
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'stats' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="send"/>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
Automatics
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'tomorrow' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="drafts"/>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
Tomorrow Deliveries
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
|
||||
</q-list>
|
||||
|
||||
@@ -109,17 +107,13 @@
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent} from 'vue'
|
||||
import EssentialLink from 'components/EssentialLink.vue'
|
||||
import {useRoute} from 'vue-router' //
|
||||
import authHeader from "../services/auth.header"
|
||||
import axios from "axios"
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MainLayout',
|
||||
|
||||
components: {
|
||||
EssentialLink
|
||||
},
|
||||
components: {},
|
||||
|
||||
data() {
|
||||
return {
|
||||
@@ -134,7 +128,7 @@ export default defineComponent({
|
||||
last_seen: '',
|
||||
admin: 0,
|
||||
admin_role: 0,
|
||||
confirmed: 0,
|
||||
confirmed: 0
|
||||
|
||||
},
|
||||
loaded: false,
|
||||
@@ -151,51 +145,50 @@ export default defineComponent({
|
||||
employee_start_date: "",
|
||||
employee_end_date: "",
|
||||
employee_type: '',
|
||||
employee_state: '',
|
||||
employee_state: ''
|
||||
},
|
||||
leftDrawerOpen: false,
|
||||
|
||||
leftDrawerOpen: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.userStatus()
|
||||
|
||||
},
|
||||
methods: {
|
||||
toggleLeftDrawer() {
|
||||
this.leftDrawerOpen = !this.leftDrawerOpen
|
||||
},
|
||||
userStatus() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
||||
const path = import.meta.env.VITE_BASE_URL + '/auth/whoami'
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.user = response.data.user;
|
||||
this.user = response.data.user
|
||||
this.getEmployee(this.user.user_id)
|
||||
} else {
|
||||
this.user.user_id = 0
|
||||
}
|
||||
})
|
||||
},
|
||||
getEmployee(userid: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/employee/" + userid;
|
||||
const path = import.meta.env.VITE_BASE_URL + "/employee/" + userid
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data) {
|
||||
|
||||
this.employee = response.data;
|
||||
this.loaded = true;
|
||||
this.employee = response.data
|
||||
this.loaded = true
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -205,6 +198,4 @@ export default defineComponent({
|
||||
.nodec {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
|
||||
<script lang="ts">
|
||||
import axios from 'axios'
|
||||
import {defineComponent} from 'vue'
|
||||
import { defineComponent } from 'vue'
|
||||
import authHeader from '../services/auth.header'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'IndexPage',
|
||||
|
||||
data() {
|
||||
data () {
|
||||
return {
|
||||
token: null,
|
||||
delivery_count: 0,
|
||||
@@ -42,10 +42,9 @@ export default defineComponent({
|
||||
prime: '',
|
||||
cleaning: '',
|
||||
out_of_oil: '',
|
||||
|
||||
user: {
|
||||
user_id: 0,
|
||||
user_name: '',
|
||||
user_name: ''
|
||||
},
|
||||
employee: {
|
||||
id: '',
|
||||
@@ -61,67 +60,66 @@ export default defineComponent({
|
||||
employee_start_date: "",
|
||||
employee_end_date: "",
|
||||
employee_type: '',
|
||||
employee_state: '',
|
||||
},
|
||||
employee_state: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.userStatus()
|
||||
this.get_employee();
|
||||
this.today_delivery_count();
|
||||
this.today_price_oil();
|
||||
mounted () {
|
||||
this.userStatus()
|
||||
|
||||
this.today_delivery_count()
|
||||
this.today_price_oil()
|
||||
},
|
||||
methods: {
|
||||
userStatus() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
||||
userStatus () {
|
||||
const path = import.meta.env.VITE_BASE_URL + '/auth/whoami'
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.user = response.data.user;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.user = null
|
||||
})
|
||||
},
|
||||
get_employee() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/employee/userid/' + this.user.user_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.employee = response.data;
|
||||
|
||||
|
||||
if (response.data.ok) {
|
||||
this.user = response.data.user
|
||||
this.get_employee()
|
||||
} else {
|
||||
this.user.user_id = 0
|
||||
}
|
||||
})
|
||||
},
|
||||
today_delivery_count() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/stats/delivery/count/today'
|
||||
get_employee () {
|
||||
console.log(this.user)
|
||||
const path = import.meta.env.VITE_BASE_URL + '/employee/userid/' + this.user.user_id
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.employee = response.data
|
||||
})
|
||||
},
|
||||
today_delivery_count () {
|
||||
const path = import.meta.env.VITE_BASE_URL + '/stats/delivery/count/today'
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.delivery_count = response.data.data;
|
||||
})
|
||||
},
|
||||
today_price_oil() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/info/price/oil'
|
||||
today_price_oil () {
|
||||
const path = import.meta.env.VITE_BASE_URL + '/info/price/oil'
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.today_oil_price = response.data.price;
|
||||
|
||||
@@ -1,20 +1,106 @@
|
||||
<template>
|
||||
<q-page>
|
||||
<div class="q-pa-md breakpoints">
|
||||
<div class="row text-h5">
|
||||
<div class="q-pa-md">
|
||||
<q-table
|
||||
title="Todays Deliveries"
|
||||
:rows="deliveries"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:filter="filter"
|
||||
>
|
||||
<template v-slot:top-right>
|
||||
<q-input dense debounce="300" v-model="filter" placeholder="Search">
|
||||
<template v-slot:append>
|
||||
<q-icon name="search"/>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="pointer q-hoverable" @click="onEdit(props.row)" >
|
||||
|
||||
</div>
|
||||
<q-td
|
||||
key="id"
|
||||
:props="props"
|
||||
>
|
||||
{{props.row.id}}
|
||||
</q-td>
|
||||
<q-td
|
||||
key="name"
|
||||
:props="props"
|
||||
>
|
||||
{{props.row.customer_name}}
|
||||
</q-td>
|
||||
|
||||
<q-td
|
||||
key="address"
|
||||
:props="props"
|
||||
>
|
||||
{{props.row.customer_address}}
|
||||
</q-td>
|
||||
|
||||
<q-td
|
||||
key="town"
|
||||
:props="props"
|
||||
>
|
||||
{{props.row.customer_town}}
|
||||
</q-td>
|
||||
|
||||
<q-td
|
||||
key="gallons_ordered"
|
||||
:props="props"
|
||||
>
|
||||
<span v-if="props.row.customer_asked_for_fill== 0"> {{props.row.gallons_ordered}}</span>
|
||||
<span v-if="props.row.customer_asked_for_fill== 1"> Fill</span>
|
||||
</q-td>
|
||||
|
||||
|
||||
<q-td
|
||||
key="automatic"
|
||||
:props="props"
|
||||
>
|
||||
<span v-if="props.row.automatic== 0">No</span>
|
||||
<span v-if="props.row.automatic == 1">Yes</span>
|
||||
</q-td>
|
||||
|
||||
<q-td
|
||||
key="payment"
|
||||
:props="props"
|
||||
>
|
||||
<span v-if="props.row.payment== 0">Cash</span>
|
||||
<span v-if="props.row.payment == 1">Credit</span>
|
||||
</q-td>
|
||||
<q-td
|
||||
key="prime"
|
||||
:props="props"
|
||||
>
|
||||
<span v-if="props.row.prime== 0"></span>
|
||||
<span v-if="props.row.prime == 1">YES</span>
|
||||
</q-td>
|
||||
|
||||
<q-td
|
||||
key="same_day"
|
||||
:props="props"
|
||||
>
|
||||
<span v-if="props.row.same_day== 0"></span>
|
||||
<span v-if="props.row.same_day == 1">YES</span>
|
||||
</q-td>
|
||||
|
||||
|
||||
</q-tr>
|
||||
</template>
|
||||
</q-table>
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts">
|
||||
import axios from 'axios'
|
||||
import {defineComponent} from 'vue'
|
||||
import authHeader from '../services/auth.header'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'todaydeliveries',
|
||||
name: 'TodayDelivery',
|
||||
|
||||
data() {
|
||||
return {
|
||||
@@ -22,8 +108,9 @@ export default defineComponent({
|
||||
deliveries: [],
|
||||
user: {
|
||||
user_id: 0,
|
||||
user_name: '',
|
||||
user_name: ''
|
||||
},
|
||||
filter: '',
|
||||
employee: {
|
||||
id: '',
|
||||
user_id: '',
|
||||
@@ -38,67 +125,82 @@ export default defineComponent({
|
||||
employee_start_date: "",
|
||||
employee_end_date: "",
|
||||
employee_type: '',
|
||||
employee_state: '',
|
||||
employee_state: ''
|
||||
},
|
||||
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
required: true,
|
||||
label: 'Deliver Id #',
|
||||
align: 'left',
|
||||
field: 'id',
|
||||
sortable: true
|
||||
},
|
||||
{ name: 'name', align: 'center', label: 'Name', field: 'name', sortable: true },
|
||||
{ name: 'address', label: 'Address', field: 'address' },
|
||||
{ name: 'town', label: 'Town', field: 'town', sortable: true },
|
||||
{ name: 'gallons_ordered', label: 'Gallons', field: 'gallons_ordered' },
|
||||
{ name: 'automatic', label: 'Automatic', field: 'automatic', sortable: true },
|
||||
{ name: 'payment', label: 'Payment', field: 'payment' },
|
||||
{ name: 'prime', label: 'Prime', field: 'prime' },
|
||||
{ name: 'same_day', label: 'Same Day', field: 'same_day' },
|
||||
|
||||
]
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.userStatus()
|
||||
|
||||
|
||||
this.userStatus()
|
||||
},
|
||||
methods: {
|
||||
|
||||
userStatus() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
||||
const path = import.meta.env.VITE_BASE_URL + '/auth/whoami'
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.user = response.data.user;
|
||||
this.get_employee();
|
||||
}
|
||||
})
|
||||
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.user = response.data.user
|
||||
this.get_employee()
|
||||
}
|
||||
})
|
||||
},
|
||||
get_employee() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/employee/userid/' + this.user.user_id;
|
||||
const path = import.meta.env.VITE_BASE_URL + '/employee/userid/' + this.user.user_id
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.employee = response.data;
|
||||
this.get_oil_orders()
|
||||
|
||||
this.employee = response.data
|
||||
this.get_oil_orders()
|
||||
})
|
||||
},
|
||||
get_oil_orders() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/delivery/today/driver/' + this.user.user_id;
|
||||
const path = import.meta.env.VITE_BASE_URL + '/deliverystatus/today/driver/' + this.employee.id
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
withCredentials: true,
|
||||
headers: authHeader()
|
||||
}).then((response: any) => {
|
||||
this.deliveries = response.data
|
||||
})
|
||||
},
|
||||
},
|
||||
onEdit (row: any) {
|
||||
this.$router.push('delivery/' + row.id)
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="sass">
|
||||
.breakpoints
|
||||
.row > div
|
||||
padding: 10px 15px
|
||||
|
||||
.row + .row
|
||||
margin-top: 1rem
|
||||
.my-sticky-header-table
|
||||
.q-table tbody td
|
||||
font-size: 20px
|
||||
</style>
|
||||
|
||||
@@ -1,18 +1,98 @@
|
||||
<template>
|
||||
<q-page class="row justify-evenly">
|
||||
tommorrow
|
||||
<q-page>
|
||||
<div class="q-pa-md breakpoints">
|
||||
<div class="row text-h5">
|
||||
{{ deliveries }}
|
||||
</div>
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import axios from 'axios'
|
||||
import { defineComponent } from 'vue'
|
||||
import authHeader from '../services/auth.header'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TommorrowDelivery',
|
||||
|
||||
data () {
|
||||
|
||||
return {
|
||||
token: null,
|
||||
deliveries: [],
|
||||
user: {
|
||||
user_id: 0,
|
||||
user_name: ''
|
||||
},
|
||||
employee: {
|
||||
id: '',
|
||||
user_id: '',
|
||||
employee_last_name: "",
|
||||
employee_first_name: "",
|
||||
employee_town: "",
|
||||
employee_address: "",
|
||||
employee_apt: "",
|
||||
employee_zip: "",
|
||||
employee_birthday: "",
|
||||
employee_phone_number: "",
|
||||
employee_start_date: "",
|
||||
employee_end_date: "",
|
||||
employee_type: '',
|
||||
employee_state: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.userStatus()
|
||||
},
|
||||
methods: {
|
||||
userStatus () {
|
||||
const path = import.meta.env.VITE_BASE_URL + '/auth/whoami'
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.user = response.data.user
|
||||
this.get_employee()
|
||||
}
|
||||
})
|
||||
},
|
||||
get_employee () {
|
||||
const path = import.meta.env.VITE_BASE_URL + '/employee/userid/' + this.user.user_id
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.employee = response.data
|
||||
this.get_oil_orders()
|
||||
})
|
||||
},
|
||||
get_oil_orders () {
|
||||
const path = import.meta.env.VITE_BASE_URL + '/deliverystatus/tommorrow/driver/' + this.employee.id
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader()
|
||||
}).then((response: any) => {
|
||||
this.deliveries = response.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
.breakpoints
|
||||
.row > div
|
||||
padding: 10px 15px
|
||||
.row + .row
|
||||
margin-top: 1rem
|
||||
</style>
|
||||
|
||||
98
src/pages/WaitingDelivery.vue
Normal file
98
src/pages/WaitingDelivery.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<q-page>
|
||||
<div class="q-pa-md breakpoints">
|
||||
<div class="row text-h5">
|
||||
{{ deliveries }}
|
||||
</div>
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import axios from 'axios'
|
||||
import { defineComponent } from 'vue'
|
||||
import authHeader from '../services/auth.header'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'WaitingDelivery',
|
||||
|
||||
data () {
|
||||
return {
|
||||
token: null,
|
||||
deliveries: [],
|
||||
user: {
|
||||
user_id: 0,
|
||||
user_name: ''
|
||||
},
|
||||
employee: {
|
||||
id: '',
|
||||
user_id: '',
|
||||
employee_last_name: "",
|
||||
employee_first_name: "",
|
||||
employee_town: "",
|
||||
employee_address: "",
|
||||
employee_apt: "",
|
||||
employee_zip: "",
|
||||
employee_birthday: "",
|
||||
employee_phone_number: "",
|
||||
employee_start_date: "",
|
||||
employee_end_date: "",
|
||||
employee_type: '',
|
||||
employee_state: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.userStatus()
|
||||
},
|
||||
methods: {
|
||||
userStatus () {
|
||||
const path = import.meta.env.VITE_BASE_URL + '/auth/whoami'
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.user = response.data.user
|
||||
this.get_employee()
|
||||
}
|
||||
})
|
||||
},
|
||||
get_employee () {
|
||||
const path = import.meta.env.VITE_BASE_URL + '/employee/userid/' + this.user.user_id
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.employee = response.data
|
||||
this.get_oil_orders()
|
||||
})
|
||||
},
|
||||
get_oil_orders () {
|
||||
const path = import.meta.env.VITE_BASE_URL + '/deliverystatus/waiting/driver/' + this.employee.id
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader()
|
||||
}).then((response: any) => {
|
||||
this.deliveries = response.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
.breakpoints
|
||||
.row > div
|
||||
padding: 10px 15px
|
||||
.row + .row
|
||||
margin-top: 1rem
|
||||
</style>
|
||||
@@ -2,28 +2,27 @@
|
||||
<q-page class=" window-height window-width row justify-center ">
|
||||
<div class="column">
|
||||
<div class="row text-center">
|
||||
<h5 class="text-h5 text-white q-my-md text-center full-width ">Auburn Oil</h5>
|
||||
<h5 class="text-h5 text-white q-my-md text-center full-width">
|
||||
Auburn Oil
|
||||
</h5>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<q-form class="q-gutter-md" @submit="onSubmit">
|
||||
|
||||
<q-form class="q-gutter-md" @submit="onSubmit">
|
||||
<q-card square bordered class="q-pa-lg shadow-1">
|
||||
|
||||
<q-card-section>
|
||||
|
||||
<q-input v-model="loginForm.username" square filled type="text" label="username"/>
|
||||
<q-input v-model="loginForm.password" square filled type="password" label="password"/>
|
||||
|
||||
<q-card-section >
|
||||
<q-input v-model="loginForm.username" square filled class="q-pa-sm" type="text" label="username"/>
|
||||
<q-input v-model="loginForm.password" square filled class="q-pa-sm" type="password" label="password"/>
|
||||
</q-card-section>
|
||||
<q-card-actions class="q-px-md">
|
||||
<q-btn type="Submit" unelevated color="light-blue-7" size="lg" class="full-width" label="Login"/>
|
||||
</q-card-actions>
|
||||
|
||||
<q-card-section class="text-center q-pa-none">
|
||||
<p class="text-grey-6">Not reigistered? Created an Account</p>
|
||||
<p class="text-grey-6"></p>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-form>
|
||||
</q-form>
|
||||
</div>
|
||||
</div>
|
||||
</q-page>
|
||||
@@ -32,18 +31,18 @@
|
||||
<script lang="ts">
|
||||
|
||||
import axios from "axios"
|
||||
import {defineComponent} from "vue"
|
||||
import { defineComponent } from "vue"
|
||||
import authHeader from "../../services/auth.header"
|
||||
import {Notify} from 'quasar'
|
||||
import { Notify } from 'quasar'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Login',
|
||||
name: 'LoginPage',
|
||||
data() {
|
||||
return {
|
||||
loginForm: {
|
||||
username: "",
|
||||
password: "",
|
||||
},
|
||||
password: ""
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -67,7 +66,7 @@ export default defineComponent({
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
sendLogin(payLoad: { username: string; password: string }) {
|
||||
sendLogin (payLoad: { username: string; password: string }) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/auth/login"
|
||||
axios({
|
||||
method: "post",
|
||||
@@ -77,20 +76,20 @@ export default defineComponent({
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.user) {
|
||||
localStorage.setItem("auth_token", response.data.token);
|
||||
localStorage.setItem("auth_user", response.data.user);
|
||||
this.$router.push({name: "home"});
|
||||
localStorage.setItem("auth_token", response.data.token)
|
||||
localStorage.setItem("auth_user", response.data.user)
|
||||
this.$router.push({name: "home"})
|
||||
|
||||
Notify.create({
|
||||
message: 'You have been logged in!',
|
||||
type: 'positive',
|
||||
position: 'top',
|
||||
position: 'top'
|
||||
})
|
||||
} else if (response.data.locked) {
|
||||
Notify.create({
|
||||
message: "Account has been locked for security reasons. Please unlock.",
|
||||
type: 'negative',
|
||||
position: 'top',
|
||||
position: 'top'
|
||||
|
||||
})
|
||||
this.$router.push({name: "lostPassword"});
|
||||
@@ -98,28 +97,25 @@ export default defineComponent({
|
||||
Notify.create({
|
||||
message: "Authorization Failure",
|
||||
type: 'negative',
|
||||
position: 'top',
|
||||
position: 'top'
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
Notify.create({
|
||||
message: "Authorization Failure",
|
||||
type: 'negative',
|
||||
position: 'top',
|
||||
position: 'top'
|
||||
})
|
||||
|
||||
});
|
||||
})
|
||||
},
|
||||
onSubmit() {
|
||||
onSubmit () {
|
||||
console.log("here")
|
||||
const payLoad = {
|
||||
username: this.loginForm.username,
|
||||
password: this.loginForm.password,
|
||||
};
|
||||
this.sendLogin(payLoad);
|
||||
|
||||
password: this.loginForm.password
|
||||
}
|
||||
this.sendLogin(payLoad)
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -129,4 +125,7 @@ export default defineComponent({
|
||||
.q-card {
|
||||
width: 360px;
|
||||
}
|
||||
.nodec {
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
404
src/pages/delivery/ViewDelivery.vue
Normal file
404
src/pages/delivery/ViewDelivery.vue
Normal file
@@ -0,0 +1,404 @@
|
||||
<template>
|
||||
<div class="q-page q-pa-lg">
|
||||
<div class="row">
|
||||
<div class="col-3 bg-neutral p-5">
|
||||
<img src="../../assets/user_placeholder.png"
|
||||
alt="Drone Image"
|
||||
width="250"
|
||||
height="250"/>
|
||||
</div>
|
||||
<div class="col-3 bg-neutral p-5 ">
|
||||
<div class="row">
|
||||
<div class="col-12 font-bold flex justify-evenly pb-5">
|
||||
|
||||
</div>
|
||||
<div class="col-12 font-bold flex pb-5 text-lg">{{ customer.account_number }}</div>
|
||||
<div class="col-12 font-bold flex">
|
||||
{{ customer.customer_first_name }}
|
||||
{{ customer.customer_last_name }}
|
||||
</div>
|
||||
<div class="col-12 font-bold flex">
|
||||
|
||||
{{ customer.customer_address }}
|
||||
<div v-if="customer.customer_apt != 'None'">
|
||||
{{ customer.customer_apt }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-12 font-bold flex ">
|
||||
<div class="pr-2 q-pr-lg">
|
||||
{{ customer.customer_town }},
|
||||
</div>
|
||||
<div class="pr-2 q-pr-lg flex">
|
||||
|
||||
<div v-if="customer.customer_state == 0">Massachusetts</div>
|
||||
<div v-else-if="customer.customer_state == 1">Rhode Island</div>
|
||||
<div v-else-if="customer.customer_state == 2">New Hampshire</div>
|
||||
<div v-else-if="customer.customer_state == 3">Maine</div>
|
||||
<div v-else-if="customer.customer_state == 4">Vermont</div>
|
||||
<div v-else-if="customer.customer_state == 5">Maine</div>
|
||||
<div v-else-if="customer.customer_state == 6">New York</div>
|
||||
<div v-else>Unknown state</div>
|
||||
</div>
|
||||
<div class="pr-2 q-pr-lg flex">
|
||||
{{ customer.customer_zip }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 font-bold q-pr-lg" v-if="customer.customer_apt !== 'None'">
|
||||
{{ customer.customer_apt }}
|
||||
</div>
|
||||
<div class="col-12 font-bold q-pr-lg">
|
||||
<div v-if="customer.customer_home_type == 0">Residential</div>
|
||||
<div v-else-if="customer.customer_home_type == 1">apartment</div>
|
||||
<div v-else-if="customer.customer_home_type == 2">condo</div>
|
||||
<div v-else-if="customer.customer_home_type == 3">commercial</div>
|
||||
<div v-else-if="customer.customer_home_type == 4">business</div>
|
||||
<div v-else-if="customer.customer_home_type == 5">construction</div>
|
||||
<div v-else-if="customer.customer_home_type == 6">container</div>
|
||||
</div>
|
||||
<div class="col-12 font-bold flex q-pr-lg">
|
||||
{{ customer.customer_phone_number }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-3 bg-neutral p-5 ">
|
||||
<div class="row">
|
||||
<div class="col-4">Gallons Ordered</div>
|
||||
<div class="col-8">
|
||||
<div v-if="deliveryOrder.customer_asked_for_fill == 1">
|
||||
Fill
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ deliveryOrder.gallons_ordered }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-4">Payment Type</div>
|
||||
<div class="col-8">
|
||||
<div v-if="deliveryOrder.payment_type == 0">Cash</div>
|
||||
<div v-if="deliveryOrder.payment_type == 1">Credit</div>
|
||||
|
||||
</div>
|
||||
<div class="col-4">Expected Delivery</div>
|
||||
<div class="col-8">{{deliveryOrder.expected_delivery_date}}</div>
|
||||
<div class="col-4">Prime</div>
|
||||
<div class="col-8">
|
||||
<div v-if="deliveryOrder.prime == 0">no</div>
|
||||
<div v-if="deliveryOrder.prime == 1">Yes</div>
|
||||
</div>
|
||||
<div class="col-4">Same Day</div>
|
||||
<div class="col-8">
|
||||
<div v-if="deliveryOrder.same_day == 0">no</div>
|
||||
<div v-if="deliveryOrder.same_day == 1">YES</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="padding-top: 25px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="q-pa-md full-width row wrap justify-center items-start content-start" >
|
||||
<q-form
|
||||
@submit="onSubmit"
|
||||
class="q-gutter-md"
|
||||
>
|
||||
<div>
|
||||
<q-select
|
||||
v-model="CreateOilOrderForm.basicInfo.driver"
|
||||
option-label="employee_last_name"
|
||||
option-value="id"
|
||||
:options="truckDriversList"
|
||||
label="Driver"
|
||||
emit-value
|
||||
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<q-input
|
||||
filled
|
||||
type="number"
|
||||
v-model="CreateOilOrderForm.basicInfo.gallons_delivered"
|
||||
label="Gallons Delivered"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<q-input
|
||||
filled
|
||||
type="number"
|
||||
v-model="CreateOilOrderForm.basicInfo.cash_amount"
|
||||
label="Cash Received"
|
||||
lazy-rules
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<q-checkbox
|
||||
v-model="CreateOilOrderForm.basicInfo.customer_filled"
|
||||
left-label
|
||||
label="Filled"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<q-checkbox
|
||||
v-model="CreateOilOrderForm.basicInfo.prime"
|
||||
left-label
|
||||
label="Primed"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<q-btn label="Submit" type="submit" color="primary"/>
|
||||
</div>
|
||||
</q-form>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
|
||||
import { defineComponent } from 'vue'
|
||||
import authHeader from '../../services/auth.header'
|
||||
import axios from 'axios'
|
||||
import { Notify } from 'quasar'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ViewDelivery',
|
||||
|
||||
|
||||
data() {
|
||||
return {
|
||||
|
||||
user: null,
|
||||
deliveryStatus: [],
|
||||
truckDriversList: [],
|
||||
userCards: [],
|
||||
userCard: {
|
||||
date_added: '',
|
||||
user_id: '',
|
||||
card_number: '',
|
||||
last_four_digits: '',
|
||||
name_on_card: '',
|
||||
expiration_month: '',
|
||||
expiration_year: '',
|
||||
type_of_card: '',
|
||||
security_number: '',
|
||||
accepted_or_declined: '',
|
||||
main_card: '',
|
||||
},
|
||||
customer: {
|
||||
account_number: '',
|
||||
id: 0,
|
||||
user_id: 0,
|
||||
customer_first_name: '',
|
||||
customer_last_name: '',
|
||||
customer_address: '',
|
||||
customer_town: '',
|
||||
customer_state: 0,
|
||||
customer_zip: '',
|
||||
customer_apt: '',
|
||||
customer_home_type: 0,
|
||||
customer_phone_number: '',
|
||||
},
|
||||
deliveryOrder: {
|
||||
id: '',
|
||||
customer_id: 0,
|
||||
customer_name: '',
|
||||
customer_address: '',
|
||||
customer_town: '',
|
||||
customer_state: 0,
|
||||
customer_zip: '',
|
||||
gallons_ordered: 0,
|
||||
customer_asked_for_fill: 0,
|
||||
gallons_delivered: '',
|
||||
customer_filled: 0,
|
||||
delivery_status: 0,
|
||||
when_ordered: '',
|
||||
when_delivered: '',
|
||||
expected_delivery_date: '',
|
||||
automatic: 0,
|
||||
oil_id: 0,
|
||||
supplier_price: '',
|
||||
customer_price: '',
|
||||
customer_temperature: '',
|
||||
dispatcher_notes: '',
|
||||
prime: 0,
|
||||
same_day: 0,
|
||||
payment_type: 0,
|
||||
payment_card_id: 0,
|
||||
driver_employee_id: 0,
|
||||
driver_first_name: '',
|
||||
driver_last_name: '',
|
||||
},
|
||||
CreateOilOrderForm: {
|
||||
basicInfo: {
|
||||
driver: '',
|
||||
gallons_delivered: '',
|
||||
customer_filled: false,
|
||||
prime: false,
|
||||
cash_amount: 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.userStatus()
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
this.getDeliveryForm(this.$route.params.id);
|
||||
this.getDeliveryOrder(this.$route.params.id);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getDeliveryForm(this.$route.params.id)
|
||||
this.getDeliveryOrder(this.$route.params.id);
|
||||
this.getDeliveryStatusList();
|
||||
this.getDriversList();
|
||||
},
|
||||
methods: {
|
||||
userStatus() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.user = response.data.user;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.user = null
|
||||
})
|
||||
},
|
||||
getDriversList() {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/employee/drivers";
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.truckDriversList = response.data;
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
|
||||
getDeliveryOrder(delivery_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/delivery/" + delivery_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data) {
|
||||
|
||||
if (response.data.delivery.delivery_asked_for_fill == 0){
|
||||
this.CreateOilOrderForm.basicInfo.gallons_delivered = response.data.delivery.delivery_gallons_ordered
|
||||
}
|
||||
this.CreateOilOrderForm.basicInfo.cash_amount = response.data.delivery.cash_amount;
|
||||
if (response.data.delivery.delivery_prime == 0){
|
||||
this.CreateOilOrderForm.basicInfo.prime = false;
|
||||
}
|
||||
else {
|
||||
this.CreateOilOrderForm.basicInfo.prime = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
getDeliveryForm(delivery_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/delivery/order/" + delivery_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data) {
|
||||
this.deliveryOrder = response.data
|
||||
this.getCustomer(this.deliveryOrder.customer_id)
|
||||
}
|
||||
})
|
||||
},
|
||||
getCustomer(user_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/customer/" + user_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.customer = response.data;
|
||||
})
|
||||
.catch(() => {
|
||||
Notify.create({
|
||||
message: 'Could not find customer',
|
||||
type: 'negative',
|
||||
position: 'top'
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
editOilOrder(payload: {
|
||||
gallons_delivered: string,
|
||||
customer_filled: boolean,
|
||||
prime: boolean,
|
||||
cash_amount: number,
|
||||
}) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/delivery/edit/" + this.deliveryOrder.id;
|
||||
axios({
|
||||
method: "post",
|
||||
url: path,
|
||||
data: payload,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.$router.push({name: "delivery"});
|
||||
}
|
||||
if (response.data.error) {
|
||||
this.$router.push("/");
|
||||
}
|
||||
})
|
||||
},
|
||||
getDeliveryStatusList() {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/query/deliverystatus";
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.deliveryStatus = response.data;
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
|
||||
onSubmit() {
|
||||
let payload = {
|
||||
gallons_delivered: this.CreateOilOrderForm.basicInfo.gallons_delivered,
|
||||
customer_filled: this.CreateOilOrderForm.basicInfo.customer_filled,
|
||||
prime: this.CreateOilOrderForm.basicInfo.prime,
|
||||
cash_amount: this.CreateOilOrderForm.basicInfo.cash_amount,
|
||||
|
||||
};
|
||||
this.editOilOrder(payload);
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -8,8 +8,10 @@ const routes: RouteRecordRaw[] = [
|
||||
{ path: '', name: 'home', component: () => import('pages/IndexPage.vue') },
|
||||
{ path: '/today', name: 'today', component: () => import('pages/TodayDelivery.vue') },
|
||||
{ path: '/tomorrow', name: 'tomorrow', component: () => import('pages/TomorrowDelivery.vue') },
|
||||
{ path: '/waiting', name: 'waiting', component: () => import('pages/WaitingDelivery.vue') },
|
||||
{ path: '/automatic', name: 'automatic', component: () => import('pages/Automatics.vue') },
|
||||
{ path: '/stats', name: 'stats', component: () => import('pages/DriverStats.vue') },
|
||||
{ path: '/delivery/:id', name: 'viewdelivery', component: () => import('pages/delivery/ViewDelivery.vue') }
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user