| Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 1 | import { createApp } from 'vue'; |
| 2 | |
| Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 3 | import App from './App.vue'; |
| Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 4 | import i18n from './i18n'; |
| 5 | |
| Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 6 | import router from './router'; |
| Yoshie Muranaka | 8263d85 | 2020-10-16 07:58:06 -0700 | [diff] [blame] | 7 | |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 8 | import { format } from 'date-fns-tz'; |
| Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 9 | |
| Yoshie Muranaka | 8263d85 | 2020-10-16 07:58:06 -0700 | [diff] [blame] | 10 | //Do not change store import. |
| 11 | //Exact match alias set to support |
| 12 | //dotenv customizations. |
| Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 13 | import store from './store'; |
| Konstantin | fb6c6de | 2023-06-14 17:23:14 +0300 | [diff] [blame] | 14 | import eventBus from './eventBus'; |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 15 | import { ToastPlugin } from './plugins/toast'; |
| Yoshie Muranaka | 8263d85 | 2020-10-16 07:58:06 -0700 | [diff] [blame] | 16 | |
| Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 17 | import { |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 18 | BButton, |
| 19 | BContainer, |
| 20 | BForm, |
| 21 | BFormGroup, |
| 22 | BFormInput, |
| 23 | BFormCheckboxGroup, |
| 24 | BInputGroup, |
| 25 | BInputGroupText, |
| 26 | BFormSelect, |
| 27 | BFormSelectOption, |
| 28 | BFormFile, |
| 29 | BFormCheckbox, |
| 30 | BFormRadioGroup, |
| 31 | BFormRadio, |
| 32 | BFormText, |
| 33 | BFormTextarea, |
| 34 | BFormTags, |
| 35 | BFormInvalidFeedback, |
| 36 | BTable, |
| 37 | BToast, |
| 38 | BModal, |
| 39 | BCloseButton, |
| 40 | BAlert, |
| 41 | BCard, |
| 42 | BCardHeader, |
| 43 | BCardBody, |
| 44 | BCardFooter, |
| 45 | BCardGroup, |
| 46 | BRow, |
| 47 | BCol, |
| 48 | BBadge, |
| 49 | BSpinner, |
| 50 | BDropdown, |
| 51 | BDropdownItem, |
| 52 | BNav, |
| 53 | BNavbar, |
| 54 | BNavbarBrand, |
| 55 | BNavbarNav, |
| 56 | BNavItem, |
| 57 | BNavbarToggle, |
| 58 | BCollapse, |
| 59 | BPagination, |
| 60 | BTooltip, |
| 61 | BPopover, |
| 62 | BProgress, |
| 63 | BProgressBar, |
| 64 | BOverlay, |
| 65 | BListGroup, |
| 66 | BListGroupItem, |
| 67 | BTabs, |
| 68 | BTab, |
| 69 | BLink, |
| 70 | BOrchestrator, |
| 71 | createBootstrap, |
| 72 | vBToggle, |
| 73 | vBTooltip, |
| 74 | vBPopover, |
| 75 | vBModal, |
| 76 | } from 'bootstrap-vue-next'; |
| Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 77 | |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 78 | const app = createApp(App); |
| 79 | |
| 80 | // Note: We register only the components/directives we need |
| 81 | |
| 82 | // Use createBootstrap for all bootstrap-vue-next plugins in 0.40.7+ |
| 83 | app.use(createBootstrap()); |
| 84 | |
| 85 | app.component('BButton', BButton); |
| 86 | app.component('BBtn', BButton); |
| 87 | app.component('BContainer', BContainer); |
| 88 | app.component('BForm', BForm); |
| 89 | app.component('BFormGroup', BFormGroup); |
| 90 | app.component('BFormInput', BFormInput); |
| 91 | app.component('BFormCheckboxGroup', BFormCheckboxGroup); |
| 92 | app.component('BInputGroup', BInputGroup); |
| 93 | app.component('BInputGroupText', BInputGroupText); |
| 94 | app.component('BFormSelect', BFormSelect); |
| 95 | app.component('BFormSelectOption', BFormSelectOption); |
| 96 | app.component('BFormFile', BFormFile); |
| 97 | app.component('BFormCheckbox', BFormCheckbox); |
| 98 | app.component('BFormRadioGroup', BFormRadioGroup); |
| 99 | app.component('BFormRadio', BFormRadio); |
| 100 | app.component('BFormText', BFormText); |
| 101 | app.component('BFormTextarea', BFormTextarea); |
| 102 | app.component('BFormTags', BFormTags); |
| 103 | app.component('BFormInvalidFeedback', BFormInvalidFeedback); |
| 104 | app.component('BTable', BTable); |
| 105 | app.component('BToast', BToast); |
| 106 | app.component('BModal', BModal); |
| 107 | app.component('BCloseButton', BCloseButton); |
| 108 | app.component('BAlert', BAlert); |
| 109 | app.component('BCard', BCard); |
| 110 | app.component('BCardHeader', BCardHeader); |
| 111 | app.component('BCardBody', BCardBody); |
| 112 | app.component('BCardFooter', BCardFooter); |
| 113 | app.component('BCardGroup', BCardGroup); |
| 114 | app.component('BRow', BRow); |
| 115 | app.component('BCol', BCol); |
| 116 | app.component('BBadge', BBadge); |
| 117 | app.component('BSpinner', BSpinner); |
| 118 | app.component('BDropdown', BDropdown); |
| 119 | app.component('BDropdownItem', BDropdownItem); |
| 120 | app.component('BNav', BNav); |
| 121 | app.component('BNavbar', BNavbar); |
| 122 | app.component('BNavbarBrand', BNavbarBrand); |
| 123 | app.component('BNavbarNav', BNavbarNav); |
| 124 | app.component('BNavItem', BNavItem); |
| 125 | app.component('BNavbarToggle', BNavbarToggle); |
| 126 | app.component('BCollapse', BCollapse); |
| 127 | app.component('BPagination', BPagination); |
| 128 | app.component('BTooltip', BTooltip); |
| 129 | app.component('BPopover', BPopover); |
| 130 | app.component('BProgress', BProgress); |
| 131 | app.component('BProgressBar', BProgressBar); |
| 132 | app.component('BOverlay', BOverlay); |
| 133 | app.component('BListGroup', BListGroup); |
| 134 | app.component('BListGroupItem', BListGroupItem); |
| 135 | app.component('BTabs', BTabs); |
| 136 | app.component('BTab', BTab); |
| 137 | app.component('BLink', BLink); |
| 138 | app.component('BOrchestrator', BOrchestrator); |
| 139 | |
| 140 | // Register BootstrapVue Next directives used in templates |
| 141 | app.directive('b-toggle', vBToggle); |
| 142 | app.directive('b-tooltip', vBTooltip); |
| 143 | app.directive('b-popover', vBPopover); |
| 144 | app.directive('b-modal', vBModal); |
| 145 | |
| Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 146 | app.use(i18n); |
| Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 147 | app.use(router); |
| 148 | app.use(store); |
| Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 149 | app.use(ToastPlugin); |
| Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 150 | |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 151 | app.config.globalProperties.$eventBus = eventBus; |
| 152 | app.config.globalProperties.$confirm = (messageOrOptions) => { |
| 153 | return new Promise((resolve) => { |
| 154 | eventBus.$emit('confirm:open', { |
| 155 | ...(typeof messageOrOptions === 'string' |
| 156 | ? { message: messageOrOptions } |
| 157 | : messageOrOptions), |
| 158 | resolve, |
| 159 | }); |
| 160 | }); |
| 161 | }; |
| 162 | |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 163 | //Filters |
| 164 | const filter = { |
| 165 | formatDate(value) { |
| 166 | const isUtcDisplay = store.getters['global/isUtcDisplay']; |
| 167 | |
| 168 | if (value instanceof Date) { |
| 169 | if (isUtcDisplay) { |
| 170 | return value.toISOString().substring(0, 10); |
| 171 | } |
| 172 | const pattern = `yyyy-MM-dd`; |
| 173 | const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; |
| 174 | return format(value, pattern, { timezone }); |
| 175 | } |
| 176 | }, |
| 177 | formatTime(value) { |
| 178 | const isUtcDisplay = store.getters['global/isUtcDisplay']; |
| 179 | |
| 180 | if (value instanceof Date) { |
| 181 | if (isUtcDisplay) { |
| 182 | let timeOptions = { |
| 183 | timeZone: 'UTC', |
| 184 | hourCycle: 'h23', |
| 185 | }; |
| 186 | return `${value.toLocaleTimeString('default', timeOptions)} UTC`; |
| 187 | } |
| 188 | const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; |
| 189 | const shortTz = this.shortTimeZone(value); |
| 190 | const pattern = `HH:mm:ss ('${shortTz}' O)`; |
| 191 | return format(value, pattern, { timezone }).replace('GMT', 'UTC'); |
| 192 | } |
| 193 | }, |
| 194 | shortTimeZone(value) { |
| 195 | const longTZ = value |
| 196 | .toString() |
| 197 | .match(/\((.*)\)/) |
| 198 | .pop(); |
| 199 | const regexNotUpper = /[*a-z ]/g; |
| 200 | return longTZ.replace(regexNotUpper, ''); |
| 201 | }, |
| 202 | }; |
| 203 | app.config.globalProperties.$filters = filter; |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 204 | |
| 205 | app.mount('#app'); |