201 lines
6.7 KiB
JavaScript
201 lines
6.7 KiB
JavaScript
import { createStore } from "vuex";
|
|
|
|
const store = createStore({
|
|
state() {
|
|
return {
|
|
assetEditable: false,
|
|
assetFiltered: false,
|
|
assetSearchable: false,
|
|
deleteAsset: false,
|
|
onAssetlist: true,
|
|
onCustomerAssetlist: false,
|
|
onAsset: false,
|
|
onSolutionlistAsset: false,
|
|
chosenAssetId: -1,
|
|
filteredAssetbyClient: '',
|
|
newAsset: false,
|
|
newAssetName: '',
|
|
newCustomerID: '',
|
|
newCustomer: '',
|
|
newLocation: '',
|
|
newRemoteLocation: '',
|
|
newType: '',
|
|
newDescription: '',
|
|
newNotes: '',
|
|
newState: '',
|
|
newLastView: '',
|
|
newUser: '',
|
|
hardwareBool: false,
|
|
newModel: '',
|
|
newSerialnumber: '',
|
|
newCPU: '',
|
|
newRAM: '',
|
|
newStorageConfiguration: '',
|
|
newMiscellaneous: '',
|
|
softwareBool: false,
|
|
newSoftware: '',
|
|
newVersion: '',
|
|
newLicense: '',
|
|
};
|
|
},
|
|
mutations: {
|
|
toggleEditableAsset(state) {
|
|
state.assetEditable = !state.assetEditable
|
|
},
|
|
toggleFilteredAsset(state) {
|
|
if (state.assetFiltered == false) {
|
|
state.assetFiltered = true
|
|
state.assetSearchable = false
|
|
} else {
|
|
state.assetFiltered = false
|
|
}
|
|
},
|
|
changeToAssetlist(state) {
|
|
state.onAssetlist = true
|
|
state.onCustomerAssetlist = false
|
|
state.onAsset = false
|
|
state.onSolutionlistAsset = false
|
|
},
|
|
changeToCustomerAssetlist(state) {
|
|
state.onAssetlist = false
|
|
state.onCustomerAssetlist = true
|
|
state.onAsset = false
|
|
state.onSolutionlistAsset = false
|
|
},
|
|
changeToAsset(state) {
|
|
state.onAssetlist = false
|
|
state.onCustomerAssetlist = false
|
|
state.onAsset = true
|
|
state.onSolutionlistAsset = false
|
|
},
|
|
changeToSolutionlistAsset(state) {
|
|
state.onAssetlist = false
|
|
state.onCustomerAssetlist = false
|
|
state.onAsset = false
|
|
state.onSolutionlistAsset = true
|
|
},
|
|
setChosenAsset(state, id) {
|
|
state.chosenAssetId = id
|
|
},
|
|
resetAssetStore(state) {
|
|
state.assetEditable = false
|
|
state.assetFiltered = false
|
|
state.assetSearchable = false
|
|
state.deleteAsset = false
|
|
state.chosenAssetId = -1
|
|
state.filteredAssetbyClient = ''
|
|
state.newAsset = false
|
|
state.newAssetName = ''
|
|
state.newCustomerID = ''
|
|
state.newCustomer = ''
|
|
state.newLocation = ''
|
|
state.newRemoteLocation = ''
|
|
state.newType = ''
|
|
state.newDescription = ''
|
|
state.newNotes = ''
|
|
state.newState = ''
|
|
state.newLastView = ''
|
|
state.newUser = ''
|
|
state.hardwareBool = false
|
|
state.newModel = ''
|
|
state.newSerialnumber = ''
|
|
state.newCPU = ''
|
|
state.newRAM = ''
|
|
state.newStorageConfiguration = ''
|
|
state.newMiscellaneous = ''
|
|
state.softwareBool = false
|
|
state.newSoftware = ''
|
|
state.newVersion = ''
|
|
state.newLicense = ''
|
|
},
|
|
|
|
// functions to change the production order and maintenance visit pages
|
|
changeToTemplatelist(state) {
|
|
state.onTemplatelist = true
|
|
state.onCustomerTemplatelist = false
|
|
state.onTemplate = false
|
|
state.onInstancelist = false
|
|
state.onInstance = false
|
|
},
|
|
changeToCustomerTemplatelist(state) {
|
|
state.onTemplatelist = false
|
|
state.onCustomerTemplatelist = true
|
|
state.onTemplate = false
|
|
state.onInstancelist = false
|
|
state.onInstance = false
|
|
},
|
|
changeToTemplate(state) {
|
|
state.onTemplatelist = false
|
|
state.onCustomerTemplatelist = false
|
|
state.onTemplate = true
|
|
state.onInstancelist = false
|
|
state.onInstance = false
|
|
},
|
|
changeToInstancelist(state) {
|
|
state.onTemplatelist = false
|
|
state.onCustomerTemplatelist = false
|
|
state.onTemplate = false
|
|
state.onInstancelist = true
|
|
state.onInstance = false
|
|
},
|
|
doDeleteAsset(state) {
|
|
state.deleteAsset = true
|
|
},
|
|
undoDeleteAsset(state) {
|
|
state.deleteAsset = false
|
|
},
|
|
updateAssetFilterbyClient(state, client) {
|
|
state.filteredAssetbyClient = client
|
|
},
|
|
toggleAssetSearchable(state) {
|
|
if (state.assetSearchable == false) {
|
|
state.assetSearchable = true
|
|
state.assetFiltered = false
|
|
} else {
|
|
state.assetSearchable = false
|
|
}
|
|
state.filteredAssetbyClient = ''
|
|
},
|
|
addNewAsset(state) {
|
|
state.newAsset = true
|
|
state.assetEditable = false
|
|
state.assetFiltered = false
|
|
state.assetSearchable = false
|
|
state.onAssetlist = false
|
|
state.onCustomerAssetlist = false
|
|
state.onAsset = true
|
|
state.onSolutionlistAsset = false
|
|
},
|
|
updateAssetComponent(state, asset) {
|
|
state.newAssetName = asset.assetName
|
|
state.newCustomerID = asset.customerId
|
|
state.newCustomer = asset.customer
|
|
state.newLocation = asset.location
|
|
state.newRemoteLocation = asset.remoteLocation
|
|
state.newType = asset.type
|
|
state.newDescription = asset.description
|
|
state.newNotes = asset.notes
|
|
state.newState = asset.state
|
|
},
|
|
updateHardwareComponent(state, asset) {
|
|
state.hardwareBool = asset.hardwareBool
|
|
state.newModel = asset.model
|
|
state.newSerialnumber = asset.serialnumber
|
|
state.newCPU = asset.CPU
|
|
state.newRAM = asset.RAM
|
|
state.newStorageConfiguration = asset.storageConfig
|
|
state.newMiscellaneous = asset.miscellaneous
|
|
},
|
|
updateSoftwareComponent(state, asset) {
|
|
state.softwareBool = asset.softwareBool
|
|
state.newSoftware = asset.software
|
|
state.newVersion = asset.version
|
|
state.newLicense = asset.license
|
|
}
|
|
},
|
|
});
|
|
|
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
nuxtApp.vueApp.use(store);
|
|
// Install the store instance as a plugin
|
|
}); |