Aliases.vue 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  1. <template>
  2. <div>
  3. <div class="flex flex-wrap flex-row items-center justify-between mb-8 md:px-2 lg:px-6">
  4. <div
  5. class="w-full md:w-1/2 lg:w-1/3 xl:w-1/6 md:-mx-2 lg:-mx-6 rounded overflow-hidden shadow-md bg-white mb-4 lg:mb-4 xl:mb-0"
  6. >
  7. <div class="p-4 flex items-center justify-between relative">
  8. <icon
  9. name="check-circle"
  10. class="inline-block w-16 h-16 text-indigo-50 stroke-current absolute top-0 right-0"
  11. />
  12. <div class="font-bold text-xl md:text-3xl text-indigo-800">
  13. {{ totalActive }}
  14. <p class="text-grey-300 text-sm tracking-wide uppercase">Active</p>
  15. </div>
  16. </div>
  17. </div>
  18. <div
  19. class="w-full md:w-1/2 lg:w-1/3 xl:w-1/6 md:-mx-2 lg:-mx-6 rounded overflow-hidden shadow-md bg-white mb-4 lg:mb-4 xl:mb-0"
  20. >
  21. <div class="p-4 flex items-center justify-between relative">
  22. <icon
  23. name="cross-circle"
  24. class="inline-block w-16 h-16 text-indigo-50 stroke-current absolute top-0 right-0"
  25. />
  26. <div class="font-bold text-xl md:text-3xl text-indigo-800">
  27. {{ totalInactive }}
  28. <p class="text-grey-300 text-sm tracking-wide uppercase">Inactive</p>
  29. </div>
  30. </div>
  31. </div>
  32. <div
  33. class="w-full md:w-1/2 lg:w-1/3 xl:w-1/6 md:-mx-2 lg:-mx-6 rounded overflow-hidden shadow-md bg-white mb-4 lg:mb-4 xl:mb-0"
  34. >
  35. <div class="p-4 flex items-center justify-between relative">
  36. <icon
  37. name="send"
  38. class="inline-block w-16 h-16 text-indigo-50 stroke-current absolute top-0 right-0"
  39. />
  40. <div class="font-bold text-xl md:text-3xl text-indigo-800">
  41. {{ totalForwarded }}
  42. <p class="text-grey-300 text-sm tracking-wide uppercase">Emails Forwarded</p>
  43. </div>
  44. </div>
  45. </div>
  46. <div
  47. class="w-full md:w-1/2 lg:w-1/3 xl:w-1/6 md:-mx-2 lg:-mx-6 rounded overflow-hidden shadow-md bg-white mb-4 lg:mb-0"
  48. >
  49. <div class="p-4 flex items-center justify-between relative">
  50. <icon
  51. name="blocked"
  52. class="inline-block w-16 h-16 text-indigo-50 stroke-current absolute top-0 right-0"
  53. />
  54. <div class="font-bold text-xl md:text-3xl text-indigo-800">
  55. {{ totalBlocked }}
  56. <p class="text-grey-300 text-sm tracking-wide uppercase">Emails Blocked</p>
  57. </div>
  58. </div>
  59. </div>
  60. <div
  61. class="w-full md:w-1/2 lg:w-1/3 xl:w-1/6 md:-mx-2 lg:-mx-6 rounded overflow-hidden shadow-md bg-white mb-4 md:mb-0"
  62. >
  63. <div class="p-4 flex items-center justify-between relative">
  64. <icon
  65. name="corner-up-left"
  66. class="inline-block w-16 h-16 text-indigo-50 stroke-current absolute top-0 right-0"
  67. />
  68. <div class="font-bold text-xl md:text-3xl text-indigo-800">
  69. {{ totalReplies }}
  70. <p class="text-grey-300 text-sm tracking-wide uppercase">Email Replies</p>
  71. </div>
  72. </div>
  73. </div>
  74. <div
  75. class="w-full md:w-1/2 lg:w-1/3 xl:w-1/6 md:-mx-2 lg:-mx-6 rounded overflow-hidden shadow-md bg-white"
  76. >
  77. <div class="p-4 flex items-center justify-between relative">
  78. <icon
  79. name="inbox"
  80. class="inline-block w-16 h-16 text-indigo-50 stroke-current absolute top-0 right-0"
  81. />
  82. <div class="font-bold text-xl md:text-3xl text-indigo-800">
  83. {{ bandwidthMb }}<span class="text-sm tracking-wide uppercase">MB</span>
  84. <p class="text-grey-300 text-sm tracking-wide uppercase">Bandwidth ({{ month }})</p>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="mb-6 flex flex-col md:flex-row justify-between md:items-center">
  90. <div class="relative">
  91. <input
  92. v-model="search"
  93. @keyup.esc="search = ''"
  94. tabindex="0"
  95. type="text"
  96. class="w-full md:w-64 appearance-none shadow bg-white text-grey-700 focus:outline-none rounded py-3 pl-3 pr-8"
  97. placeholder="Search Aliases"
  98. />
  99. <icon
  100. v-if="search"
  101. @click.native="search = ''"
  102. name="close-circle"
  103. class="absolute right-0 inset-y-0 w-5 h-full text-grey-300 fill-current mr-2 flex items-center cursor-pointer"
  104. />
  105. <icon
  106. v-else
  107. name="search"
  108. class="absolute right-0 inset-y-0 w-5 h-full text-grey-300 fill-current pointer-events-none mr-2 flex items-center"
  109. />
  110. </div>
  111. <div class="flex flex-wrap mt-4 md:mt-0">
  112. <div class="block relative mr-4">
  113. <select
  114. v-model="showAliases"
  115. class="block appearance-none w-full text-grey-700 bg-white p-3 pr-8 rounded shadow focus:ring"
  116. required
  117. >
  118. <option value="without">Hide Deleted</option>
  119. <option value="with">Show Deleted</option>
  120. <option value="only">Deleted Only</option>
  121. </select>
  122. <div
  123. class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"
  124. >
  125. <svg
  126. class="fill-current h-4 w-4"
  127. xmlns="http://www.w3.org/2000/svg"
  128. viewBox="0 0 20 20"
  129. >
  130. <path
  131. d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"
  132. />
  133. </svg>
  134. </div>
  135. </div>
  136. <div>
  137. <button
  138. @click="generateAliasModalOpen = true"
  139. class="bg-cyan-400 hover:bg-cyan-300 text-cyan-900 font-bold py-3 px-4 rounded focus:outline-none ml-auto"
  140. >
  141. Create New Alias
  142. </button>
  143. </div>
  144. </div>
  145. </div>
  146. <vue-good-table
  147. v-if="initialAliases.length"
  148. @on-search="debounceToolips"
  149. @on-page-change="debounceToolips"
  150. :columns="columns"
  151. :rows="rows"
  152. :search-options="{
  153. enabled: true,
  154. skipDiacritics: true,
  155. externalQuery: search,
  156. }"
  157. :sort-options="{
  158. enabled: true,
  159. initialSortBy: { field: 'created_at', type: 'desc' },
  160. }"
  161. :pagination-options="{
  162. enabled: true,
  163. mode: 'pages',
  164. perPage: 25,
  165. perPageDropdown: [25, 50, 100],
  166. rowsPerPageLabel: 'Aliases per page',
  167. }"
  168. styleClass="vgt-table"
  169. >
  170. <div slot="emptystate" class="flex items-center justify-center h-24 text-lg text-grey-700">
  171. No aliases found for that search!
  172. </div>
  173. <template slot="table-row" slot-scope="props">
  174. <span v-if="props.column.field == 'created_at'" class="flex items-center">
  175. <span
  176. :class="`bg-${getAliasStatus(props.row).colour}-100`"
  177. class="tooltip outline-none h-4 w-4 rounded-full flex items-center justify-center mr-2"
  178. :data-tippy-content="getAliasStatus(props.row).status"
  179. tabindex="-1"
  180. >
  181. <span
  182. :class="`bg-${getAliasStatus(props.row).colour}-400`"
  183. class="h-2 w-2 rounded-full"
  184. ></span>
  185. </span>
  186. <span
  187. class="tooltip outline-none text-sm whitespace-nowrap"
  188. :data-tippy-content="rows[props.row.originalIndex].created_at | formatDate"
  189. >{{ props.row.created_at | timeAgo }}
  190. </span>
  191. </span>
  192. <span v-else-if="props.column.field == 'email'" class="block">
  193. <span
  194. class="text-grey-400 tooltip cursor-pointer outline-none"
  195. data-tippy-content="Click to copy"
  196. v-clipboard="() => getAliasEmail(rows[props.row.originalIndex])"
  197. v-clipboard:success="clipboardSuccess"
  198. v-clipboard:error="clipboardError"
  199. ><span class="font-semibold text-indigo-800">{{
  200. getAliasLocalPart(props.row) | truncate(60)
  201. }}</span
  202. ><span v-if="getAliasLocalPart(props.row).length <= 60">{{
  203. ('@' + props.row.domain) | truncate(60 - getAliasLocalPart(props.row).length)
  204. }}</span>
  205. </span>
  206. <div v-if="aliasIdToEdit === props.row.id" class="flex items-center">
  207. <input
  208. @keyup.enter="editAlias(rows[props.row.originalIndex])"
  209. @keyup.esc="aliasIdToEdit = aliasDescriptionToEdit = ''"
  210. v-model="aliasDescriptionToEdit"
  211. type="text"
  212. class="flex-grow text-sm appearance-none bg-grey-100 border text-grey-700 focus:outline-none rounded px-2 py-1"
  213. :class="aliasDescriptionToEdit.length > 100 ? 'border-red-500' : 'border-transparent'"
  214. placeholder="Add description"
  215. tabindex="0"
  216. autofocus
  217. />
  218. <icon
  219. name="close"
  220. class="inline-block w-6 h-6 text-red-300 fill-current cursor-pointer"
  221. @click.native="aliasIdToEdit = aliasDescriptionToEdit = ''"
  222. />
  223. <icon
  224. name="save"
  225. class="inline-block w-6 h-6 text-cyan-500 fill-current cursor-pointer"
  226. @click.native="editAlias(rows[props.row.originalIndex])"
  227. />
  228. </div>
  229. <div v-else-if="props.row.description" class="flex items-center">
  230. <span class="inline-block text-grey-400 text-sm py-1 border border-transparent">
  231. {{ props.row.description | truncate(60) }}
  232. </span>
  233. <icon
  234. name="edit"
  235. class="inline-block w-6 h-6 ml-2 text-grey-300 fill-current cursor-pointer"
  236. @click.native="
  237. ;(aliasIdToEdit = props.row.id), (aliasDescriptionToEdit = props.row.description)
  238. "
  239. />
  240. </div>
  241. <div v-else>
  242. <span
  243. class="inline-block text-grey-300 text-sm cursor-pointer py-1 border border-transparent"
  244. @click=";(aliasIdToEdit = props.row.id), (aliasDescriptionToEdit = '')"
  245. >Add description</span
  246. >
  247. </div>
  248. </span>
  249. <span
  250. v-else-if="props.column.field == 'recipients'"
  251. class="flex items-center justify-center"
  252. >
  253. <span
  254. v-if="props.row.recipients.length && props.row.id !== recipientsAliasToEdit.id"
  255. class="inline-block tooltip outline-none font-semibold text-indigo-800"
  256. :data-tippy-content="recipientsTooltip(props.row.recipients)"
  257. >
  258. {{ props.row.recipients.length }}
  259. </span>
  260. <span v-else-if="props.row.id === recipientsAliasToEdit.id">{{
  261. aliasRecipientsToEdit.length ? aliasRecipientsToEdit.length : '1'
  262. }}</span>
  263. <span
  264. v-else-if="has(props.row.aliasable, 'default_recipient.email')"
  265. class="py-1 px-2 text-xs bg-yellow-200 text-yellow-900 rounded-full tooltip outline-none"
  266. :data-tippy-content="props.row.aliasable.default_recipient.email"
  267. >{{
  268. props.row.aliasable_type === 'App\\Models\\Domain' ? 'domain' : 'username'
  269. }}'s</span
  270. >
  271. <span
  272. v-else
  273. class="py-1 px-2 text-xs bg-yellow-200 text-yellow-900 rounded-full tooltip outline-none"
  274. :data-tippy-content="defaultRecipient.email"
  275. >default</span
  276. >
  277. <icon
  278. name="edit"
  279. class="ml-2 inline-block w-6 h-6 text-grey-300 fill-current cursor-pointer"
  280. @click.native="openAliasRecipientsModal(props.row)"
  281. />
  282. </span>
  283. <span
  284. v-else-if="props.column.field == 'emails_forwarded'"
  285. class="font-semibold text-indigo-800"
  286. >
  287. {{ props.row.emails_forwarded }}
  288. </span>
  289. <span
  290. v-else-if="props.column.field == 'emails_blocked'"
  291. class="font-semibold text-indigo-800"
  292. >
  293. {{ props.row.emails_blocked }}
  294. </span>
  295. <span
  296. v-else-if="props.column.field == 'emails_replied'"
  297. class="font-semibold text-indigo-800"
  298. >
  299. {{ props.row.emails_replied }} <span class="text-grey-300">/</span>
  300. {{ props.row.emails_sent }}
  301. </span>
  302. <span v-else-if="props.column.field === 'active'" class="flex items-center">
  303. <Toggle
  304. v-model="rows[props.row.originalIndex].active"
  305. @on="activateAlias(props.row.id)"
  306. @off="deactivateAlias(props.row.id)"
  307. />
  308. </span>
  309. <span v-else class="flex items-center justify-center outline-none" tabindex="-1">
  310. <more-options>
  311. <div role="none">
  312. <span
  313. @click="openSendFromModal(props.row)"
  314. class="group cursor-pointer flex items-center px-4 py-3 text-sm text-grey-700 hover:bg-grey-100 hover:text-grey-900"
  315. role="menuitem"
  316. >
  317. <icon name="send" class="block mr-3 w-5 h-5 text-grey-300 outline-none" />
  318. Send From
  319. </span>
  320. </div>
  321. <div v-if="props.row.deleted_at" role="none">
  322. <span
  323. @click="openRestoreModal(props.row.id)"
  324. class="group cursor-pointer flex items-center px-4 py-3 text-sm text-grey-700 hover:bg-grey-100 hover:text-grey-900"
  325. role="menuitem"
  326. >
  327. <icon
  328. name="undo"
  329. class="block mr-3 w-5 h-5 text-grey-300 fill-current outline-none"
  330. />
  331. Restore
  332. </span>
  333. </div>
  334. <div v-else role="none">
  335. <span
  336. @click="openDeleteModal(props.row.id)"
  337. class="group cursor-pointer flex items-center px-4 py-3 text-sm text-grey-700 hover:bg-grey-100 hover:text-grey-900"
  338. role="menuitem"
  339. >
  340. <icon
  341. name="trash"
  342. class="block mr-3 w-5 h-5 text-grey-300 fill-current outline-none"
  343. />
  344. Delete
  345. </span>
  346. </div>
  347. </more-options>
  348. </span>
  349. </template>
  350. </vue-good-table>
  351. <div v-else class="bg-white rounded shadow overflow-x-auto">
  352. <div class="p-8 text-center text-lg text-grey-700">
  353. <h1 class="mb-6 text-2xl text-indigo-800 font-semibold">
  354. It doesn't look like you have any aliases yet!
  355. </h1>
  356. <div class="mx-auto mb-6 w-24 border-b-2 border-grey-200"></div>
  357. <p class="mb-4">There are two ways to create new aliases.</p>
  358. <h3 class="mb-4 text-xl text-indigo-800 font-semibold">
  359. Option 1: Create aliases on the fly
  360. </h3>
  361. <p class="mb-4">
  362. To create aliases on the fly all you have to do is make up any new alias and give that out
  363. instead of your real email address.
  364. </p>
  365. <p class="mb-4">
  366. Let's say you're signing up to <b>example.com</b> you could enter
  367. <b>example@{{ subdomain }}</b> as your email address.
  368. </p>
  369. <p class="mb-4">
  370. The alias will show up here automatically as soon as it has forwarded its first email.
  371. </p>
  372. <p class="mb-4">
  373. If you start receiving spam to the alias you can simply deactivate it or delete it all
  374. together!
  375. </p>
  376. <p class="mb-4">
  377. Try it out now by sending an email to <b>first@{{ subdomain }}</b> and then refresh this
  378. page.
  379. </p>
  380. <h3 class="mb-4 text-xl text-indigo-800 font-semibold">
  381. Option 2: Generate a unique random alias
  382. </h3>
  383. <p class="mb-4">
  384. You can click the button above to generate a random alias that will look something like
  385. this:
  386. </p>
  387. <p class="mb-4">
  388. <b>86064c92-da41-443e-a2bf-5a7b0247842f@{{ domain }}</b>
  389. </p>
  390. <p>
  391. Useful if you do not wish to include your username in the email as a potential link
  392. between aliases.
  393. </p>
  394. </div>
  395. </div>
  396. <Modal :open="generateAliasModalOpen" @close="generateAliasModalOpen = false">
  397. <div class="max-w-lg w-full bg-white rounded-lg shadow-2xl p-6">
  398. <h2
  399. class="font-semibold text-grey-900 text-2xl leading-tight border-b-2 border-grey-100 pb-4"
  400. >
  401. Create new alias
  402. </h2>
  403. <p class="mt-4 text-grey-700">
  404. Other aliases e.g. alias@{{ subdomain }} can also be created automatically when they
  405. receive their first email.
  406. </p>
  407. <label for="alias_domain" class="block text-grey-700 text-sm my-2"> Alias Domain: </label>
  408. <div class="block relative w-full mb-4">
  409. <select
  410. v-model="generateAliasDomain"
  411. id="alias_domain"
  412. class="block appearance-none w-full text-grey-700 bg-grey-100 p-3 pr-8 rounded shadow focus:ring"
  413. required
  414. >
  415. <option v-for="domainOption in domainOptions" :key="domainOption" :value="domainOption">
  416. {{ domainOption }}
  417. </option>
  418. </select>
  419. <div
  420. class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"
  421. >
  422. <svg
  423. class="fill-current h-4 w-4"
  424. xmlns="http://www.w3.org/2000/svg"
  425. viewBox="0 0 20 20"
  426. >
  427. <path
  428. d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"
  429. />
  430. </svg>
  431. </div>
  432. </div>
  433. <label for="alias_domain" class="block text-grey-700 text-sm mt-4 mb-2">
  434. Alias Format:
  435. </label>
  436. <div class="block relative w-full mb-4">
  437. <select
  438. v-model="generateAliasFormat"
  439. id="alias_domain"
  440. class="block appearance-none w-full text-grey-700 bg-grey-100 p-3 pr-8 rounded shadow focus:ring"
  441. required
  442. >
  443. <option
  444. v-for="formatOption in aliasFormatOptions"
  445. :key="formatOption.value"
  446. :value="formatOption.value"
  447. >
  448. {{ formatOption.label }}
  449. </option>
  450. </select>
  451. <div
  452. class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"
  453. >
  454. <svg
  455. class="fill-current h-4 w-4"
  456. xmlns="http://www.w3.org/2000/svg"
  457. viewBox="0 0 20 20"
  458. >
  459. <path
  460. d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"
  461. />
  462. </svg>
  463. </div>
  464. </div>
  465. <div v-if="generateAliasFormat === 'custom'">
  466. <label for="alias_local_part" class="block text-grey-700 text-sm my-2">
  467. Alias Local Part:
  468. </label>
  469. <p v-show="errors.generateAliasLocalPart" class="mb-3 text-red-500 text-sm">
  470. {{ errors.generateAliasLocalPart }}
  471. </p>
  472. <input
  473. v-model="generateAliasLocalPart"
  474. id="alias_local_part"
  475. type="text"
  476. class="w-full appearance-none bg-grey-100 border border-transparent text-grey-700 focus:outline-none rounded p-3"
  477. :class="errors.generateAliasLocalPart ? 'border-red-500' : ''"
  478. placeholder="Enter local part..."
  479. autofocus
  480. />
  481. </div>
  482. <label for="alias_description" class="block text-grey-700 text-sm my-2">
  483. Description:
  484. </label>
  485. <p v-show="errors.generateAliasDescription" class="mb-3 text-red-500 text-sm">
  486. {{ errors.generateAliasDescription }}
  487. </p>
  488. <input
  489. v-model="generateAliasDescription"
  490. id="alias_description"
  491. type="text"
  492. class="w-full appearance-none bg-grey-100 border border-transparent text-grey-700 focus:outline-none rounded p-3"
  493. :class="errors.generateAliasDescription ? 'border-red-500' : ''"
  494. placeholder="Enter description (optional)..."
  495. autofocus
  496. />
  497. <div class="mt-6">
  498. <button
  499. @click="generateNewAlias"
  500. class="bg-cyan-400 hover:bg-cyan-300 text-cyan-900 font-bold py-3 px-4 rounded focus:outline-none"
  501. :class="generateAliasLoading ? 'cursor-not-allowed' : ''"
  502. :disabled="generateAliasLoading"
  503. >
  504. Create Alias
  505. <loader v-if="generateAliasLoading" />
  506. </button>
  507. <button
  508. @click="generateAliasModalOpen = false"
  509. class="ml-4 px-4 py-3 text-grey-800 font-semibold bg-white hover:bg-grey-50 border border-grey-100 rounded focus:outline-none"
  510. >
  511. Cancel
  512. </button>
  513. </div>
  514. </div>
  515. </Modal>
  516. <Modal :open="editAliasRecipientsModalOpen" @close="closeAliasRecipientsModal">
  517. <div class="max-w-lg w-full bg-white rounded-lg shadow-2xl px-6 py-6">
  518. <h2
  519. class="font-semibold text-grey-900 text-2xl leading-tight border-b-2 border-grey-100 pb-4"
  520. >
  521. Update Alias Recipients
  522. </h2>
  523. <p class="my-4 text-grey-700">
  524. Select the recipients for this alias. You can choose multiple recipients. Leave it empty
  525. if you would like to use the default recipient.
  526. </p>
  527. <multiselect
  528. v-model="aliasRecipientsToEdit"
  529. :options="recipientOptions"
  530. :multiple="true"
  531. :close-on-select="true"
  532. :clear-on-select="false"
  533. :searchable="true"
  534. :max="10"
  535. placeholder="Select recipients"
  536. label="email"
  537. track-by="email"
  538. :preselect-first="false"
  539. :show-labels="false"
  540. >
  541. </multiselect>
  542. <div class="mt-6">
  543. <button
  544. type="button"
  545. @click="editAliasRecipients()"
  546. class="px-4 py-3 text-cyan-900 font-semibold bg-cyan-400 hover:bg-cyan-300 border border-transparent rounded focus:outline-none"
  547. :class="editAliasRecipientsLoading ? 'cursor-not-allowed' : ''"
  548. :disabled="editAliasRecipientsLoading"
  549. >
  550. Update Recipients
  551. <loader v-if="editAliasRecipientsLoading" />
  552. </button>
  553. <button
  554. @click="closeAliasRecipientsModal()"
  555. class="ml-4 px-4 py-3 text-grey-800 font-semibold bg-white hover:bg-grey-50 border border-grey-100 rounded focus:outline-none"
  556. >
  557. Cancel
  558. </button>
  559. </div>
  560. </div>
  561. </Modal>
  562. <Modal :open="restoreAliasModalOpen" @close="closeRestoreModal">
  563. <div class="max-w-lg w-full bg-white rounded-lg shadow-2xl px-6 py-6">
  564. <h2
  565. class="font-semibold text-grey-900 text-2xl leading-tight border-b-2 border-grey-100 pb-4"
  566. >
  567. Restore alias
  568. </h2>
  569. <p class="mt-4 text-grey-700">
  570. Are you sure you want to restore this alias? Once restored, this alias will
  571. <b>be able to receive emails again</b>.
  572. </p>
  573. <div class="mt-6">
  574. <button
  575. type="button"
  576. @click="restoreAlias(aliasIdToRestore)"
  577. class="px-4 py-3 text-cyan-900 font-semibold bg-cyan-400 hover:bg-cyan-300 border border-transparent rounded focus:outline-none"
  578. :class="restoreAliasLoading ? 'cursor-not-allowed' : ''"
  579. :disabled="restoreAliasLoading"
  580. >
  581. Restore alias
  582. <loader v-if="restoreAliasLoading" />
  583. </button>
  584. <button
  585. @click="closeRestoreModal"
  586. class="ml-4 px-4 py-3 text-grey-800 font-semibold bg-white hover:bg-grey-50 border border-grey-100 rounded focus:outline-none"
  587. >
  588. Cancel
  589. </button>
  590. </div>
  591. </div>
  592. </Modal>
  593. <Modal :open="deleteAliasModalOpen" @close="closeDeleteModal">
  594. <div class="max-w-lg w-full bg-white rounded-lg shadow-2xl px-6 py-6">
  595. <h2
  596. class="font-semibold text-grey-900 text-2xl leading-tight border-b-2 border-grey-100 pb-4"
  597. >
  598. Delete alias
  599. </h2>
  600. <p class="mt-4 text-grey-700">
  601. Are you sure you want to delete this alias? <b>You can restore this alias</b> if you later
  602. change your mind. Once deleted, this alias will <b>reject any emails sent to it</b>.
  603. </p>
  604. <div class="mt-6">
  605. <button
  606. type="button"
  607. @click="deleteAlias(aliasIdToDelete)"
  608. class="px-4 py-3 text-white font-semibold bg-red-500 hover:bg-red-600 border border-transparent rounded focus:outline-none"
  609. :class="deleteAliasLoading ? 'cursor-not-allowed' : ''"
  610. :disabled="deleteAliasLoading"
  611. >
  612. Delete alias
  613. <loader v-if="deleteAliasLoading" />
  614. </button>
  615. <button
  616. @click="closeDeleteModal"
  617. class="ml-4 px-4 py-3 text-grey-800 font-semibold bg-white hover:bg-grey-50 border border-grey-100 rounded focus:outline-none"
  618. >
  619. Cancel
  620. </button>
  621. </div>
  622. </div>
  623. </Modal>
  624. <Modal :open="sendFromAliasModalOpen" @close="closeSendFromModal">
  625. <div class="max-w-lg w-full bg-white rounded-lg shadow-2xl px-6 py-6">
  626. <h2
  627. class="font-semibold text-grey-900 text-2xl leading-tight border-b-2 border-grey-100 pb-4"
  628. >
  629. Send from alias
  630. </h2>
  631. <p class="mt-4 text-grey-700">
  632. Use this to automatically create the correct address to send an email to in order to send
  633. an <b>email from this alias</b>.
  634. </p>
  635. <label for="send_from_alias" class="block text-grey-700 text-sm my-2"> Alias: </label>
  636. <input
  637. v-model="aliasToSendFrom.email"
  638. id="send_from_alias"
  639. type="text"
  640. class="w-full appearance-none bg-grey-100 border border-transparent text-grey-700 focus:outline-none rounded p-3"
  641. disabled
  642. />
  643. <label for="send_from_alias_destination" class="block text-grey-700 text-sm my-2">
  644. Email destination:
  645. </label>
  646. <p v-show="errors.sendFromAliasDestination" class="mb-3 text-red-500 text-sm">
  647. {{ errors.sendFromAliasDestination }}
  648. </p>
  649. <input
  650. v-model="sendFromAliasDestination"
  651. id="send_from_alias_destination"
  652. type="text"
  653. class="w-full appearance-none bg-grey-100 border border-transparent text-grey-700 focus:outline-none rounded p-3"
  654. :class="errors.sendFromAliasDestination ? 'border-red-500' : ''"
  655. placeholder="Enter email..."
  656. autofocus
  657. />
  658. <div v-if="sendFromAliasEmailToSendTo">
  659. <p for="alias_domain" class="block text-grey-700 text-sm my-2">
  660. Send your message to this email:
  661. </p>
  662. <div
  663. v-clipboard="() => sendFromAliasEmailToSendTo"
  664. v-clipboard:success="setSendFromAliasCopied"
  665. class="flex items-center justify-between cursor-pointer text-xs border-t-4 rounded-sm text-green-800 border-green-600 bg-green-100 p-2 mb-3"
  666. role="alert"
  667. >
  668. <span>
  669. {{ sendFromAliasEmailToSendTo }}
  670. </span>
  671. <svg
  672. v-if="sendFromAliasCopied"
  673. viewBox="0 0 24 24"
  674. width="20"
  675. height="20"
  676. stroke="currentColor"
  677. stroke-width="2"
  678. fill="none"
  679. stroke-linecap="round"
  680. stroke-linejoin="round"
  681. >
  682. <polyline points="9 11 12 14 22 4"></polyline>
  683. <path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path>
  684. </svg>
  685. <svg
  686. v-else
  687. viewBox="0 0 24 24"
  688. width="20"
  689. height="20"
  690. stroke="currentColor"
  691. stroke-width="2"
  692. fill="none"
  693. stroke-linecap="round"
  694. stroke-linejoin="round"
  695. >
  696. <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
  697. <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
  698. </svg>
  699. </div>
  700. </div>
  701. <div class="mt-6">
  702. <button
  703. type="button"
  704. @click="displaySendFromAddress(aliasToSendFrom)"
  705. class="px-4 py-3 text-cyan-900 font-semibold bg-cyan-400 hover:bg-cyan-300 border border-transparent rounded focus:outline-none"
  706. :class="sendFromAliasLoading ? 'cursor-not-allowed' : ''"
  707. :disabled="sendFromAliasLoading"
  708. >
  709. Show address
  710. <loader v-if="sendFromAliasLoading" />
  711. </button>
  712. <button
  713. @click="closeSendFromModal"
  714. class="ml-4 px-4 py-3 text-grey-800 font-semibold bg-white hover:bg-grey-50 border border-grey-100 rounded focus:outline-none"
  715. >
  716. Cancel
  717. </button>
  718. </div>
  719. </div>
  720. </Modal>
  721. </div>
  722. </template>
  723. <script>
  724. import Modal from './../components/Modal.vue'
  725. import Toggle from './../components/Toggle.vue'
  726. import MoreOptions from './../components/MoreOptions.vue'
  727. import { roundArrow } from 'tippy.js'
  728. import 'tippy.js/dist/svg-arrow.css'
  729. import 'tippy.js/dist/tippy.css'
  730. import tippy from 'tippy.js'
  731. import Multiselect from 'vue-multiselect'
  732. export default {
  733. props: {
  734. defaultRecipient: {
  735. type: Object,
  736. required: true,
  737. },
  738. initialAliases: {
  739. type: Array,
  740. required: true,
  741. },
  742. recipientOptions: {
  743. type: Array,
  744. required: true,
  745. },
  746. totalForwarded: {
  747. type: Number,
  748. required: true,
  749. },
  750. totalBlocked: {
  751. type: Number,
  752. required: true,
  753. },
  754. totalReplies: {
  755. type: Number,
  756. required: true,
  757. },
  758. domain: {
  759. type: String,
  760. required: true,
  761. },
  762. subdomain: {
  763. type: String,
  764. required: true,
  765. },
  766. bandwidthMb: {
  767. type: Number,
  768. required: true,
  769. },
  770. month: {
  771. type: String,
  772. required: true,
  773. },
  774. domainOptions: {
  775. type: Array,
  776. required: true,
  777. },
  778. defaultAliasDomain: {
  779. type: String,
  780. required: true,
  781. },
  782. defaultAliasFormat: {
  783. type: String,
  784. required: true,
  785. },
  786. },
  787. components: {
  788. Modal,
  789. Toggle,
  790. Multiselect,
  791. MoreOptions,
  792. },
  793. data() {
  794. return {
  795. search: '',
  796. showAliases: 'without',
  797. aliasIdToEdit: '',
  798. aliasDescriptionToEdit: '',
  799. aliasIdToDelete: '',
  800. aliasToSendFrom: {},
  801. sendFromAliasDestination: '',
  802. sendFromAliasEmailToSendTo: '',
  803. sendFromAliasCopied: false,
  804. aliasIdToRestore: '',
  805. deleteAliasLoading: false,
  806. deleteAliasModalOpen: false,
  807. sendFromAliasLoading: false,
  808. sendFromAliasModalOpen: false,
  809. restoreAliasLoading: false,
  810. restoreAliasModalOpen: false,
  811. editAliasRecipientsLoading: false,
  812. editAliasRecipientsModalOpen: false,
  813. generateAliasModalOpen: false,
  814. generateAliasLoading: false,
  815. generateAliasDomain: this.defaultAliasDomain ? this.defaultAliasDomain : this.domain,
  816. generateAliasLocalPart: '',
  817. generateAliasDescription: '',
  818. generateAliasFormat: this.defaultAliasFormat ? this.defaultAliasFormat : 'random_characters',
  819. aliasFormatOptions: [
  820. {
  821. value: 'random_characters',
  822. label: 'Random Characters',
  823. },
  824. {
  825. value: 'uuid',
  826. label: 'UUID',
  827. },
  828. {
  829. value: 'random_words',
  830. label: 'Random Words',
  831. },
  832. {
  833. value: 'custom',
  834. label: 'Custom',
  835. },
  836. ],
  837. recipientsAliasToEdit: {},
  838. aliasRecipientsToEdit: [],
  839. columns: [
  840. {
  841. label: 'Created',
  842. field: 'created_at',
  843. globalSearchDisabled: true,
  844. },
  845. {
  846. label: 'Alias',
  847. field: 'email',
  848. },
  849. {
  850. label: 'Recipients',
  851. field: 'recipients',
  852. tdClass: 'text-center',
  853. sortable: true,
  854. sortFn: this.sortRecipients,
  855. globalSearchDisabled: true,
  856. },
  857. {
  858. label: 'Description',
  859. field: 'description',
  860. sortable: false,
  861. hidden: true,
  862. },
  863. {
  864. label: 'Forwarded',
  865. field: 'emails_forwarded',
  866. type: 'number',
  867. tdClass: 'text-center',
  868. globalSearchDisabled: true,
  869. },
  870. {
  871. label: 'Blocked',
  872. field: 'emails_blocked',
  873. type: 'number',
  874. tdClass: 'text-center',
  875. globalSearchDisabled: true,
  876. },
  877. {
  878. label: 'Replies/Sent',
  879. field: 'emails_replied',
  880. type: 'number',
  881. tdClass: 'text-center',
  882. globalSearchDisabled: true,
  883. },
  884. {
  885. label: 'Active',
  886. field: 'active',
  887. type: 'boolean',
  888. globalSearchDisabled: true,
  889. },
  890. {
  891. label: '',
  892. field: 'actions',
  893. sortable: false,
  894. globalSearchDisabled: true,
  895. },
  896. ],
  897. rows: this.initialAliases,
  898. tippyInstance: null,
  899. errors: {},
  900. }
  901. },
  902. watch: {
  903. showAliases() {
  904. this.updateAliases()
  905. },
  906. },
  907. computed: {
  908. activeUuidAliases() {
  909. return _.filter(this.rows, alias => alias.id === alias.local_part && alias.active)
  910. },
  911. totalActive() {
  912. return _.filter(this.rows, 'active').length
  913. },
  914. totalInactive() {
  915. return _.reject(this.rows, 'active').length
  916. },
  917. },
  918. methods: {
  919. addTooltips() {
  920. if (this.tippyInstance) {
  921. _.each(this.tippyInstance, instance => instance.destroy())
  922. }
  923. this.tippyInstance = tippy('.tooltip', {
  924. arrow: roundArrow,
  925. allowHTML: true,
  926. })
  927. },
  928. debounceToolips: _.debounce(function () {
  929. this.addTooltips()
  930. }, 50),
  931. recipientsTooltip(recipients) {
  932. return _.reduce(recipients, (list, recipient) => list + `${recipient.email}<br>`, '')
  933. },
  934. openDeleteModal(id) {
  935. this.deleteAliasModalOpen = true
  936. this.aliasIdToDelete = id
  937. },
  938. closeDeleteModal() {
  939. this.deleteAliasModalOpen = false
  940. this.aliasIdToDelete = ''
  941. },
  942. openSendFromModal(alias) {
  943. this.sendFromAliasDestination = ''
  944. this.sendFromAliasEmailToSendTo = ''
  945. this.sendFromAliasCopied = false
  946. this.sendFromAliasModalOpen = true
  947. this.aliasToSendFrom = alias
  948. },
  949. closeSendFromModal() {
  950. this.sendFromAliasModalOpen = false
  951. this.aliasToSendFrom = {}
  952. },
  953. openRestoreModal(id) {
  954. this.restoreAliasModalOpen = true
  955. this.aliasIdToRestore = id
  956. },
  957. closeRestoreModal() {
  958. this.restoreAliasModalOpen = false
  959. this.aliasIdToRestore = ''
  960. },
  961. updateAliases() {
  962. axios
  963. .get(`/api/v1/aliases?deleted=${this.showAliases}`, {
  964. headers: { 'Content-Type': 'application/json' },
  965. })
  966. .then(response => {
  967. this.rows = response.data.data
  968. })
  969. .catch(error => {
  970. this.error()
  971. })
  972. },
  973. deleteAlias(id) {
  974. this.deleteAliasLoading = true
  975. axios
  976. .delete(`/api/v1/aliases/${id}`)
  977. .then(response => {
  978. this.rows = _.reject(this.rows, alias => alias.id === id)
  979. this.deleteAliasModalOpen = false
  980. this.deleteAliasLoading = false
  981. })
  982. .catch(error => {
  983. this.error()
  984. this.deleteAliasModalOpen = false
  985. this.deleteAliasLoading = false
  986. })
  987. },
  988. restoreAlias(id) {
  989. this.restoreAliasLoading = true
  990. axios
  991. .patch(`/api/v1/aliases/${id}/restore`, {
  992. headers: { 'Content-Type': 'application/json' },
  993. })
  994. .then(response => {
  995. this.updateAliases()
  996. this.restoreAliasModalOpen = false
  997. this.restoreAliasLoading = false
  998. this.success('Alias restored successfully')
  999. })
  1000. .catch(error => {
  1001. this.error()
  1002. this.restoreAliasModalOpen = false
  1003. this.restoreAliasLoading = false
  1004. })
  1005. },
  1006. openAliasRecipientsModal(alias) {
  1007. this.editAliasRecipientsModalOpen = true
  1008. this.recipientsAliasToEdit = alias
  1009. this.aliasRecipientsToEdit = alias.recipients
  1010. },
  1011. closeAliasRecipientsModal() {
  1012. this.editAliasRecipientsModalOpen = false
  1013. this.recipientsAliasToEdit = {}
  1014. this.aliasRecipientsToEdit = []
  1015. },
  1016. editAliasRecipients() {
  1017. this.editAliasRecipientsLoading = true
  1018. axios
  1019. .post(
  1020. '/api/v1/alias-recipients',
  1021. JSON.stringify({
  1022. alias_id: this.recipientsAliasToEdit.id,
  1023. recipient_ids: _.map(this.aliasRecipientsToEdit, recipient => recipient.id),
  1024. }),
  1025. {
  1026. headers: { 'Content-Type': 'application/json' },
  1027. }
  1028. )
  1029. .then(response => {
  1030. let alias = _.find(this.rows, ['id', this.recipientsAliasToEdit.id])
  1031. alias.recipients = this.aliasRecipientsToEdit
  1032. this.editAliasRecipientsModalOpen = false
  1033. this.editAliasRecipientsLoading = false
  1034. this.recipientsAliasToEdit = {}
  1035. this.aliasRecipientsToEdit = []
  1036. this.success('Alias recipients updated')
  1037. })
  1038. .catch(error => {
  1039. this.editAliasRecipientsModalOpen = false
  1040. this.editAliasRecipientsLoading = false
  1041. this.recipientsAliasToEdit = {}
  1042. this.aliasRecipientsToEdit = []
  1043. this.error()
  1044. })
  1045. },
  1046. generateNewAlias() {
  1047. this.errors = {}
  1048. // Validate alias local part
  1049. if (
  1050. this.generateAliasFormat === 'custom' &&
  1051. !this.validLocalPart(this.generateAliasLocalPart)
  1052. ) {
  1053. return (this.errors.generateAliasLocalPart = 'Valid local part required')
  1054. }
  1055. if (this.generateAliasDescription.length > 100) {
  1056. return (this.errors.generateAliasDescription = 'Description cannot exceed 100 characters')
  1057. }
  1058. this.generateAliasLoading = true
  1059. axios
  1060. .post(
  1061. '/api/v1/aliases',
  1062. JSON.stringify({
  1063. domain: this.generateAliasDomain,
  1064. local_part: this.generateAliasLocalPart,
  1065. description: this.generateAliasDescription,
  1066. format: this.generateAliasFormat,
  1067. }),
  1068. {
  1069. headers: { 'Content-Type': 'application/json' },
  1070. }
  1071. )
  1072. .then(({ data }) => {
  1073. this.generateAliasLoading = false
  1074. this.generateAliasLocalPart = ''
  1075. this.generateAliasDescription = ''
  1076. this.rows.push(data.data)
  1077. this.generateAliasModalOpen = false
  1078. this.success('New alias generated successfully')
  1079. })
  1080. .catch(error => {
  1081. this.generateAliasLoading = false
  1082. if (error.response.status === 429) {
  1083. this.error('You have reached your hourly limit for creating new aliases')
  1084. } else {
  1085. this.error()
  1086. }
  1087. })
  1088. },
  1089. editAlias(alias) {
  1090. if (this.aliasDescriptionToEdit.length > 100) {
  1091. return this.error('Description cannot be more than 100 characters')
  1092. }
  1093. axios
  1094. .patch(
  1095. `/api/v1/aliases/${alias.id}`,
  1096. JSON.stringify({
  1097. description: this.aliasDescriptionToEdit,
  1098. }),
  1099. {
  1100. headers: { 'Content-Type': 'application/json' },
  1101. }
  1102. )
  1103. .then(response => {
  1104. alias.description = this.aliasDescriptionToEdit
  1105. this.aliasIdToEdit = ''
  1106. this.aliasDescriptionToEdit = ''
  1107. this.success('Alias description updated')
  1108. })
  1109. .catch(error => {
  1110. this.aliasIdToEdit = ''
  1111. this.aliasDescriptionToEdit = ''
  1112. this.error()
  1113. })
  1114. },
  1115. activateAlias(id) {
  1116. axios
  1117. .post(
  1118. `/api/v1/active-aliases`,
  1119. JSON.stringify({
  1120. id: id,
  1121. }),
  1122. {
  1123. headers: { 'Content-Type': 'application/json' },
  1124. }
  1125. )
  1126. .then(response => {
  1127. //
  1128. })
  1129. .catch(error => {
  1130. this.error()
  1131. })
  1132. },
  1133. deactivateAlias(id) {
  1134. axios
  1135. .delete(`/api/v1/active-aliases/${id}`)
  1136. .then(response => {
  1137. //
  1138. })
  1139. .catch(error => {
  1140. this.error()
  1141. })
  1142. },
  1143. displaySendFromAddress(alias) {
  1144. this.errors = {}
  1145. if (!this.validEmail(this.sendFromAliasDestination)) {
  1146. this.errors.sendFromAliasDestination = 'Valid Email required'
  1147. return
  1148. }
  1149. this.sendFromAliasEmailToSendTo = `${
  1150. alias.local_part
  1151. }+${this.sendFromAliasDestination.replace('@', '=')}@${alias.domain}`
  1152. },
  1153. setSendFromAliasCopied() {
  1154. this.sendFromAliasCopied = true
  1155. },
  1156. getAliasEmail(alias) {
  1157. return alias.extension
  1158. ? `${alias.local_part}+${alias.extension}@${alias.domain}`
  1159. : alias.email
  1160. },
  1161. getAliasLocalPart(alias) {
  1162. return alias.extension ? `${alias.local_part}+${alias.extension}` : alias.local_part
  1163. },
  1164. getAliasStatus(alias) {
  1165. if (alias.deleted_at) {
  1166. return {
  1167. colour: 'red',
  1168. status: 'Deleted',
  1169. }
  1170. } else {
  1171. return {
  1172. colour: alias.active ? 'green' : 'grey',
  1173. status: alias.active ? 'Active' : 'Inactive',
  1174. }
  1175. }
  1176. },
  1177. sortRecipients(x, y) {
  1178. return x.length < y.length ? -1 : x.length > y.length ? 1 : 0
  1179. },
  1180. has(object, path) {
  1181. return _.has(object, path)
  1182. },
  1183. validLocalPart(part) {
  1184. let re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))$/
  1185. return re.test(part)
  1186. },
  1187. validEmail(email) {
  1188. let re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
  1189. return re.test(email)
  1190. },
  1191. clipboardSuccess() {
  1192. this.success('Copied to clipboard')
  1193. },
  1194. clipboardError() {
  1195. this.error('Could not copy to clipboard')
  1196. },
  1197. success(text = '') {
  1198. this.$notify({
  1199. title: 'Success',
  1200. text: text,
  1201. type: 'success',
  1202. })
  1203. },
  1204. error(text = 'An error has occurred, please try again later') {
  1205. this.$notify({
  1206. title: 'Error',
  1207. text: text,
  1208. type: 'error',
  1209. })
  1210. },
  1211. },
  1212. }
  1213. </script>
  1214. <style src="vue-multiselect/dist/vue-multiselect.min.css"></style>