diff --git a/package.json b/package.json index 351bf5dc..3780f34b 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "js-cookie": "2.2.0", "jsonlint": "1.6.3", "jszip": "3.2.1", + "moment": "^2.24.0", "normalize.css": "7.0.0", "nprogress": "0.2.0", "path-to-regexp": "2.4.0", diff --git a/src/api/account.js b/src/api/account.js index e18ab6e8..dd203895 100644 --- a/src/api/account.js +++ b/src/api/account.js @@ -7,6 +7,10 @@ export function fetchList(query) { return axios.get(`${apiUrl}/account/search`, { params: query }) } +export function fetchRelationships(query) { + return axios.get(`${apiUrl}/account/relationship`, { params: query }) +} + export function fetchAccount(id) { return axios.get(`${apiUrl}/account/${id}`) } @@ -14,17 +18,23 @@ export function fetchAccount(id) { export function createAccount(data) { const dto = { 'name': data.name, + 'fullName': data.fullName || data.name, 'type': data.type, 'email': data.email, 'platform': store.state.platform, 'phone': data.phone, 'status': parseInt(data.status), - 'orderConfirmationEmail': data.orderConfirmationEmail, 'addressLine1': data.address.addressLine1, 'addressLine2': data.address.addressLine2, 'county': data.address.county, 'country': data.address.country, - 'postCode': data.address.postCode + 'postCode': data.address.postCode, + 'fuelRestrictions': data.restrictions.fuels, + 'terminalRestrictions': data.restrictions.terminals, + 'paymentTermsRestrictions': data.restrictions.paymentTerms, + 'liftingPeriodRestrictions': data.restrictions.liftingPeriods, + 'sendOrderCompleteAlert': data.sendOrderCompleteAlert, + 'orderCompleteAlertText': data.orderCompleteAlertText } return axios.post(`${apiUrl}/account/create`, dto) @@ -33,17 +43,23 @@ export function createAccount(data) { export function updateAccount(data) { const dto = { 'name': data.name, + 'fullName': data.fullName || data.name, 'type': data.type, 'email': data.email, 'platform': data.platform, 'phone': data.phone, 'status': parseInt(data.status), - 'orderConfirmationEmail': data.orderConfirmationEmail, 'addressLine1': data.address.addressLine1, 'addressLine2': data.address.addressLine2, 'county': data.address.county, 'country': data.address.country, - 'postCode': data.address.postCode + 'postCode': data.address.postCode, + 'fuelRestrictions': data.restrictions.fuels, + 'terminalRestrictions': data.restrictions.terminals, + 'paymentTermsRestrictions': data.restrictions.paymentTerms, + 'liftingPeriodRestrictions': data.restrictions.liftingPeriods, + 'sendOrderCompleteAlert': data.sendOrderCompleteAlert, + 'orderCompleteAlertText': data.orderCompleteAlertText } return axios.put(`${apiUrl}/account/${data.id}`, dto) diff --git a/src/api/faq.js b/src/api/faq.js new file mode 100644 index 00000000..671b593d --- /dev/null +++ b/src/api/faq.js @@ -0,0 +1,31 @@ +import axios from 'axios' + +const FAQEndpointUrl = 'https://metadata.service.development.therig.onlinefuelslabs.io' + +export function fetchList(query) { + return axios.get(`${FAQEndpointUrl}/faqs`, { params: query }) +} + +export function fetchFaq(id) { + return axios.get(`${FAQEndpointUrl}/faqs/${id}?platform=OLFDE`) +} + +export function createFaq(data) { + const dto = __dataToDTO(data) + return axios.post(`${FAQEndpointUrl}/faqs`, dto) +} + +export function updateFaq(data) { + const dto = __dataToDTO(data) + return axios.put(`${FAQEndpointUrl}/faqs/${data._id}`, dto) +} + +function __dataToDTO(data) { + return { + 'question': data.question, + 'answer': data.answer, + 'order': parseInt(data.order), + 'status': data.status, + 'platform': 'OLFDE' + } +} diff --git a/src/api/liftingPeriod.js b/src/api/liftingPeriod.js new file mode 100644 index 00000000..fc01ef4a --- /dev/null +++ b/src/api/liftingPeriod.js @@ -0,0 +1,31 @@ +import axios from 'axios' + +const LiftingPeriodEndpointUrl = 'https://metadata.service.development.therig.onlinefuelslabs.io' + +export function fetchList(query) { + return axios.get(`${LiftingPeriodEndpointUrl}/lifting-periods`, { params: query }) +} + +export function fetchLiftingPeriod(id) { + return axios.get(`${LiftingPeriodEndpointUrl}/lifting-periods/${id}?platform=OLFDE`) +} + +export function createLiftingPeriod(data) { + const dto = { + 'name': data.name, + 'days': Number(data.days), + 'platform': data.platform || 'OLFDE' + } + + return axios.post(`${LiftingPeriodEndpointUrl}/lifting-periods`, dto) +} + +export function updateLiftingPeriod(data) { + const dto = { + 'name': data.name, + 'days': Number(data.days), + 'platform': data.platform || 'OLFDE' + } + + return axios.put(`${LiftingPeriodEndpointUrl}/lifting-periods/${data._id}`, dto) +} diff --git a/src/api/order.js b/src/api/order.js new file mode 100644 index 00000000..1585e733 --- /dev/null +++ b/src/api/order.js @@ -0,0 +1,13 @@ +import axios from 'axios' + +const apiUrl = 'https://orders.service.development.therig.onlinefuelslabs.io' + +export function fetchList(query) { + query.platform = 'OLFDE' + query.accountId = '5caf6ca5bca1f9001212b6ec' + return axios.get(`${apiUrl}/orders`, { params: query }) +} + +export function fetchOrder(id) { + return axios.get(`${apiUrl}/orders/${id}`) +} diff --git a/src/api/paymentTerm.js b/src/api/paymentTerm.js new file mode 100644 index 00000000..ac001cb4 --- /dev/null +++ b/src/api/paymentTerm.js @@ -0,0 +1,31 @@ +import axios from 'axios' + +const PaymentTermsEndpointUrl = 'https://metadata.service.development.therig.onlinefuelslabs.io' + +export function fetchList(query) { + return axios.get(`${PaymentTermsEndpointUrl}/payment-terms`, { params: query }) +} + +export function fetchPaymentTerm(id) { + return axios.get(`${PaymentTermsEndpointUrl}/payment-terms/${id}?platform=OLFDE`) +} + +export function createPaymentTerm(data) { + const dto = { + 'name': data.name, + 'days': Number(data.days), + 'platform': data.platform || 'OLFDE' + } + + return axios.post(`${PaymentTermsEndpointUrl}/payment-terms`, dto) +} + +export function updatePaymentTerm(data) { + const dto = { + 'name': data.name, + 'days': Number(data.days), + 'platform': data.platform || 'OLFDE' + } + + return axios.put(`${PaymentTermsEndpointUrl}/payment-terms/${data._id}`, dto) +} diff --git a/src/api/terminal.js b/src/api/terminal.js index 9d846580..c22aebe2 100644 --- a/src/api/terminal.js +++ b/src/api/terminal.js @@ -37,6 +37,10 @@ function __dataToDTO(data) { 'county': data.address.county, 'country': data.address.country, 'postCode': data.address.postCode, - 'identifier': data.identifier + 'identifier': data.identifier, + 'contactNumber': data.contactNumber, + 'fullName': data.fullName, + 'meta': data.meta, + 'regionId': data.region_id } } diff --git a/src/api/user.js b/src/api/user.js index bd1c7a39..3f47782a 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -62,6 +62,16 @@ export function updateUser(data) { return axios.put(`${apiUrl}/user/${data.id}`, dto) } +export function sendPasswordReset(email, type) { + const dto = { + email, + type, + platform: 'OLFDE' + } + + return axios.post(`${apiUrl}/user/password/send-reset-link`, dto) +} + function __dataToDTO(data) { return { 'firstName': data.firstName, diff --git a/src/components/Tinymce/index.vue b/src/components/Tinymce/index.vue index 0c6174c4..737e2acc 100644 --- a/src/components/Tinymce/index.vue +++ b/src/components/Tinymce/index.vue @@ -43,7 +43,7 @@ export default { }, menubar: { type: String, - default: 'file edit insert view format table' + default: '' }, height: { type: [Number, String], diff --git a/src/components/Tinymce/plugins.js b/src/components/Tinymce/plugins.js index 058d2aef..91e6849f 100644 --- a/src/components/Tinymce/plugins.js +++ b/src/components/Tinymce/plugins.js @@ -2,6 +2,7 @@ // Detail plugins list see https://www.tinymce.com/docs/plugins/ // Custom builds see https://www.tinymce.com/download/custom-builds/ -const plugins = ['advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount'] +// const plugins = ['advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount'] +const plugins = [] export default plugins diff --git a/src/router/index.js b/src/router/index.js index aaa655d6..07a507ab 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -134,6 +134,12 @@ export const asyncRoutes = [ component: () => import('@/views/accounts/list'), name: 'SellerAccountList', meta: { title: 'Seller Account List', icon: 'list', type: 'seller' } + }, + { + path: 'relationship-list', + component: () => import('@/views/accounts/relationships'), + name: 'RelationshipMatrix', + meta: { title: 'Relationships', icon: 'list' } } ] }, @@ -244,7 +250,7 @@ export const asyncRoutes = [ path: 'create', component: () => import('@/views/products/create'), name: 'CreateProduct', - meta: { title: 'Create Products', icon: 'edit' } + meta: { title: 'Create Product', icon: 'edit' } }, { path: 'edit/:id', @@ -261,6 +267,130 @@ export const asyncRoutes = [ } ] }, + { + path: '/lifting-periods', + component: Layout, + redirect: '/lifting-periods/list', + name: 'LiftingPeriods', + meta: { + title: 'Lifting Periods', + icon: 'example' + }, + children: [ + { + path: 'create', + component: () => import('@/views/liftingperiods/create'), + name: 'CreateLiftingPeriod', + meta: { title: 'Create Lifting Period', icon: 'edit' } + }, + { + path: 'edit/:id', + component: () => import('@/views/liftingperiods/edit'), + name: 'EditLiftingPeriod', + meta: { title: 'Edit Lifting Period', noCache: true, activeMenu: '/liftingperiods/list' }, + hidden: true + }, + { + path: 'list', + component: () => import('@/views/liftingperiods/list'), + name: 'LiftingPeriodList', + meta: { title: 'Lifting Period List', icon: 'list' } + } + ] + }, + { + path: '/payment-terms', + component: Layout, + redirect: '/payment-terms/list', + name: 'PaymentTerms', + meta: { + title: 'Payment Terms', + icon: 'example' + }, + children: [ + { + path: 'create', + component: () => import('@/views/paymentterms/create'), + name: 'CreatePaymentTerm', + meta: { title: 'Create Payment Terms', icon: 'edit' } + }, + { + path: 'edit/:id', + component: () => import('@/views/paymentterms/edit'), + name: 'EditPaymentTerm', + meta: { title: 'Edit Payment Terms', noCache: true, activeMenu: '/paymentterms/list' }, + hidden: true + }, + { + path: 'list', + component: () => import('@/views/paymentterms/list'), + name: 'LiftingPaymentTerm', + meta: { title: 'Payment Terms List', icon: 'list' } + } + ] + }, + { + path: '/faqs', + component: Layout, + redirect: '/faqs/list', + name: 'FAQs', + meta: { + title: 'FAQs', + icon: 'example' + }, + children: [ + { + path: 'create', + component: () => import('@/views/faqs/create'), + name: 'CreateFAQ', + meta: { title: 'Create FAQ', icon: 'edit' } + }, + { + path: 'edit/:id', + component: () => import('@/views/faqs/edit'), + name: 'EditFAQs', + meta: { title: 'Edit FAQ', noCache: true, activeMenu: '/faqs/list' }, + hidden: true + }, + { + path: 'list', + component: () => import('@/views/faqs/list'), + name: 'FAQList', + meta: { title: 'FAQ List', icon: 'list' } + } + ] + }, + { + path: '/orders', + component: Layout, + redirect: '/orders/list', + name: 'Orders', + meta: { + title: 'Orders', + icon: 'example' + }, + children: [ + { + path: 'create', + component: () => import('@/views/orders/create'), + name: 'CreateOrder', + meta: { title: 'Create Order', icon: 'edit' } + }, + { + path: 'edit/:id', + component: () => import('@/views/orders/edit'), + name: 'EditOrder', + meta: { title: 'Edit Order', noCache: true, activeMenu: '/orders/list' }, + hidden: true + }, + { + path: 'list', + component: () => import('@/views/orders/list'), + name: 'OrderList', + meta: { title: 'Order List', icon: 'list' } + } + ] + }, { path: '/permission', component: Layout, diff --git a/src/views/accounts/components/AccountDetail.vue b/src/views/accounts/components/AccountDetail.vue index e3d85cae..bafd0f20 100644 --- a/src/views/accounts/components/AccountDetail.vue +++ b/src/views/accounts/components/AccountDetail.vue @@ -22,8 +22,15 @@ - + + + + @@ -86,6 +93,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +