Playground.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <!-- eslint-disable zammad/zammad-detect-translatable-string -->
  3. <script setup lang="ts">
  4. import { reset } from '@formkit/core'
  5. import gql from 'graphql-tag'
  6. import { storeToRefs } from 'pinia'
  7. import {
  8. computed,
  9. h,
  10. onMounted,
  11. reactive,
  12. ref,
  13. watch,
  14. type Ref,
  15. useTemplateRef,
  16. } from 'vue'
  17. import CommonAlert from '#shared/components/CommonAlert/CommonAlert.vue'
  18. import CommonPopover from '#shared/components/CommonPopover/CommonPopover.vue'
  19. import type {
  20. Orientation,
  21. Placement,
  22. } from '#shared/components/CommonPopover/types.ts'
  23. import { usePopover } from '#shared/components/CommonPopover/usePopover.ts'
  24. import CommonUserAvatar from '#shared/components/CommonUserAvatar/CommonUserAvatar.vue'
  25. import Form from '#shared/components/Form/Form.vue'
  26. import type {
  27. FormSchemaNode,
  28. FormValues,
  29. } from '#shared/components/Form/types.ts'
  30. import { useConfirmation } from '#shared/composables/useConfirmation.ts'
  31. import { useCopyToClipboard } from '#shared/composables/useCopyToClipboard.ts'
  32. import { defineFormSchema } from '#shared/form/defineFormSchema.ts'
  33. import { EnumObjectManagerObjects } from '#shared/graphql/types.ts'
  34. import { useApplicationStore } from '#shared/stores/application.ts'
  35. import { useSessionStore } from '#shared/stores/session.ts'
  36. import CommonActionMenu from '#desktop/components/CommonActionMenu/CommonActionMenu.vue'
  37. import CommonBreadcrumb from '#desktop/components/CommonBreadcrumb/CommonBreadcrumb.vue'
  38. import CommonButton from '#desktop/components/CommonButton/CommonButton.vue'
  39. import CommonButtonGroup from '#desktop/components/CommonButtonGroup/CommonButtonGroup.vue'
  40. import type { CommonButtonItem } from '#desktop/components/CommonButtonGroup/types.ts'
  41. import CommonDialog from '#desktop/components/CommonDialog/CommonDialog.vue'
  42. import { useDialog } from '#desktop/components/CommonDialog/useDialog.ts'
  43. import CommonFlyout from '#desktop/components/CommonFlyout/CommonFlyout.vue'
  44. import { useFlyout } from '#desktop/components/CommonFlyout/useFlyout.ts'
  45. import CommonInlineEdit from '#desktop/components/CommonInlineEdit/CommonInlineEdit.vue'
  46. import CommonInputCopyToClipboard from '#desktop/components/CommonInputCopyToClipboard/CommonInputCopyToClipboard.vue'
  47. import CommonPopoverMenu from '#desktop/components/CommonPopoverMenu/CommonPopoverMenu.vue'
  48. import type { MenuItem } from '#desktop/components/CommonPopoverMenu/types.ts'
  49. import CommonProgressBar from '#desktop/components/CommonProgressBar/CommonProgressBar.vue'
  50. import CommonSimpleTable from '#desktop/components/CommonSimpleTable/CommonSimpleTable.vue'
  51. import CommonTabManager from '#desktop/components/CommonTabManager/CommonTabManager.vue'
  52. import { useTabManager } from '#desktop/components/CommonTabManager/useTabManager.ts'
  53. import LayoutContent from '#desktop/components/layout/LayoutContent.vue'
  54. import ThemeSwitch from '#desktop/components/ThemeSwitch/ThemeSwitch.vue'
  55. const alphabetOptions = computed(() =>
  56. [...Array(26).keys()].map((i) => ({
  57. value: i,
  58. label: `Item ${String.fromCharCode(65 + i)}`,
  59. disabled: Math.random() < 0.5,
  60. })),
  61. )
  62. const { copyToClipboard } = useCopyToClipboard()
  63. const longOption = ref({
  64. value: 999,
  65. label:
  66. 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, nullam pulvinar nunc sapien, vitae malesuada justo interdum feugiat, mauris odio, mattis et malesuada quis, vulputate vitae enim',
  67. })
  68. const permissions = [
  69. {
  70. value: 'admin',
  71. label: 'Admin interface',
  72. description: 'To configure your system.',
  73. children: [
  74. {
  75. value: 'admin.user',
  76. label: 'Users',
  77. description: 'To manage all users of your system.',
  78. },
  79. {
  80. value: 'admin.group',
  81. label: 'Groups',
  82. description: 'To manage groups of your system.',
  83. },
  84. {
  85. value: 'admin.role',
  86. label: 'Roles',
  87. description: 'To manage roles of your system.',
  88. },
  89. {
  90. value: 'admin.organization',
  91. label: 'Organizations',
  92. description: 'To manage all organizations of your system.',
  93. },
  94. {
  95. value: 'admin.overview',
  96. label: 'Overviews',
  97. description: 'To manage ticket overviews of your system.',
  98. },
  99. {
  100. value: 'admin.text_module',
  101. label: 'Text modules',
  102. description: 'To manage text modules of your system.',
  103. },
  104. {
  105. value: 'admin.macro',
  106. label: 'Macros',
  107. description: 'To manage ticket macros of your system.',
  108. },
  109. {
  110. value: 'admin.template',
  111. label: 'Templates',
  112. description: 'To manage ticket templates of your system.',
  113. },
  114. {
  115. value: 'admin.tag',
  116. label: 'Tags',
  117. description: 'To manage ticket tags of your system.',
  118. },
  119. {
  120. value: 'admin.calendar',
  121. label: 'Calendar',
  122. description: 'To manage calendars of your system.',
  123. },
  124. {
  125. value: 'admin.sla',
  126. label: 'SLAs',
  127. description: 'To manage Service Level Agreements of your system.',
  128. },
  129. {
  130. value: 'admin.trigger',
  131. label: 'Trigger',
  132. description: 'To manage triggers of your system.',
  133. },
  134. {
  135. value: 'admin.public_links',
  136. label: 'Public Links',
  137. description: 'To manage public links of your system.',
  138. },
  139. {
  140. value: 'admin.webhook',
  141. label: 'Webhook',
  142. description: 'To manage webhooks of your system.',
  143. },
  144. {
  145. value: 'admin.scheduler',
  146. label: 'Scheduler',
  147. description: 'To manage schedulers of your system.',
  148. },
  149. {
  150. value: 'admin.report_profile',
  151. label: 'Report Profiles',
  152. description: 'To manage report profiles of your system.',
  153. },
  154. {
  155. value: 'admin.time_accounting',
  156. label: 'Time Accounting',
  157. description: 'To manage time accounting settings of your system.',
  158. },
  159. {
  160. value: 'admin.knowledge_base',
  161. label: 'Knowledge Base',
  162. description: 'To create and set up Knowledge Base.',
  163. },
  164. {
  165. value: 'admin.channel_web',
  166. label: 'Web',
  167. description: 'To manage web channel of your system.',
  168. },
  169. {
  170. value: 'admin.channel_formular',
  171. label: 'Form',
  172. description: 'To manage form channel of your system.',
  173. },
  174. {
  175. value: 'admin.channel_email',
  176. label: 'Email',
  177. description: 'To manage email channel of your system.',
  178. },
  179. {
  180. value: 'admin.channel_sms',
  181. label: 'SMS',
  182. description: 'To manage SMS channel of your system.',
  183. },
  184. {
  185. value: 'admin.channel_chat',
  186. label: 'Chat',
  187. description: 'To manage chat channel of your system.',
  188. },
  189. {
  190. value: 'admin.channel_google',
  191. label: 'Google',
  192. description: 'To manage Google channel of your system.',
  193. },
  194. {
  195. value: 'admin.channel_microsoft365',
  196. label: ' Microsoft 365',
  197. description: 'To manage Microsoft 365 channel of your system.',
  198. },
  199. {
  200. value: 'admin.channel_twitter',
  201. label: 'Twitter',
  202. description: 'To manage Twitter channel of your system.',
  203. },
  204. {
  205. value: 'admin.channel_facebook',
  206. label: 'Facebook',
  207. description: 'To manage Facebook channel of your system.',
  208. },
  209. {
  210. value: 'admin.channel_telegram',
  211. label: 'Telegram',
  212. description: 'To manage Telegram channel of your system.',
  213. },
  214. {
  215. value: 'admin.channel_whatsapp',
  216. label: 'WhatsApp',
  217. description: 'To manage WhatsApp channel of your system.',
  218. },
  219. {
  220. value: 'admin.branding',
  221. label: 'Branding',
  222. description: 'To manage branding settings of your system.',
  223. },
  224. {
  225. value: 'admin.setting_system',
  226. label: 'System',
  227. description: 'To manage core system settings.',
  228. },
  229. {
  230. value: 'admin.security',
  231. label: 'Security',
  232. description: 'To manage security settings of your system.',
  233. },
  234. {
  235. value: 'admin.ticket',
  236. label: 'Ticket',
  237. description: 'To manage ticket settings of your system.',
  238. },
  239. {
  240. value: 'admin.integration',
  241. label: 'Integrations',
  242. description: 'To manage integrations of your system.',
  243. },
  244. {
  245. value: 'admin.api',
  246. label: 'API',
  247. description: 'To manage API of your system.',
  248. },
  249. {
  250. value: 'admin.object',
  251. label: 'Objects',
  252. description: 'To manage object attributes of your system.',
  253. },
  254. {
  255. value: 'admin.ticket_state',
  256. label: 'Ticket States',
  257. description: 'To manage ticket states of your system.',
  258. },
  259. {
  260. value: 'admin.ticket_priority',
  261. label: 'Ticket Priorities',
  262. description: 'To manage ticket priorities of your system.',
  263. },
  264. {
  265. value: 'admin.core_workflow',
  266. label: 'Core Workflows',
  267. description: 'To manage core workflows of your system.',
  268. },
  269. {
  270. value: 'admin.translation',
  271. label: 'Translations',
  272. description: 'To manage translations of your system.',
  273. },
  274. {
  275. value: 'admin.data_privacy',
  276. label: 'Data Privacy',
  277. description: 'To delete existing data of your system.',
  278. },
  279. {
  280. value: 'admin.maintenance',
  281. label: 'Maintenance',
  282. description: 'To manage maintenance mode of your system.',
  283. },
  284. {
  285. value: 'admin.monitoring',
  286. label: 'Monitoring',
  287. description: 'To manage monitoring of your system.',
  288. },
  289. {
  290. value: 'admin.package',
  291. label: 'Packages',
  292. description: 'To manage packages of your system.',
  293. },
  294. {
  295. value: 'admin.session',
  296. label: 'Sessions',
  297. description: 'To manage active user sessions of your system.',
  298. },
  299. {
  300. value: 'admin.system_report',
  301. label: 'System Report',
  302. description: 'To manage system report of your system.',
  303. },
  304. ],
  305. },
  306. {
  307. value: 'chat',
  308. label: 'Chat',
  309. description: 'To access the chat interface.',
  310. disabled: true,
  311. children: [
  312. {
  313. value: 'chat.agent',
  314. label: 'Agent Chat',
  315. description: 'To access the agent chat features.',
  316. },
  317. ],
  318. },
  319. {
  320. value: 'cti',
  321. label: 'Phone',
  322. description: 'To access the phone interface.',
  323. disabled: true,
  324. children: [
  325. {
  326. value: 'cti.agent',
  327. label: 'Agent Phone',
  328. description: 'To access the agent phone features.',
  329. },
  330. ],
  331. },
  332. {
  333. value: 'knowledge_base',
  334. label: 'Knowledge Base',
  335. description: 'To access the knowledge base interface.',
  336. disabled: true,
  337. children: [
  338. {
  339. value: 'knowledge_base.editor',
  340. label: 'Knowledge Base Editor',
  341. description: 'To access the knowledge base editor features.',
  342. },
  343. {
  344. value: 'knowledge_base.reader',
  345. label: 'Knowledge Base Reader',
  346. description: 'To access the knowledge base reader features.',
  347. },
  348. ],
  349. },
  350. {
  351. value: 'report',
  352. label: 'Report',
  353. description: 'To access the report interface.',
  354. },
  355. {
  356. value: 'ticket',
  357. label: 'Ticket',
  358. description: 'To access the ticket interface.',
  359. disabled: true,
  360. children: [
  361. {
  362. value: 'ticket.agent',
  363. label: 'Agent Tickets',
  364. description: 'To access the agent tickets based on group access.',
  365. },
  366. {
  367. value: 'ticket.customer',
  368. label: 'Customer Tickets',
  369. description: 'To access the customer tickets.',
  370. },
  371. ],
  372. },
  373. {
  374. value: 'user_preferences',
  375. label: 'Profile settings',
  376. description: 'To access the personal settings.',
  377. children: [
  378. {
  379. value: 'user_preferences.appearance',
  380. label: 'Appearance',
  381. description: 'To access the appearance personal setting.',
  382. },
  383. {
  384. value: 'user_preferences.language',
  385. label: 'Language',
  386. description: 'To access the language personal setting.',
  387. },
  388. {
  389. value: 'user_preferences.avatar',
  390. label: 'Avatar',
  391. description: 'To access the avatar personal setting.',
  392. },
  393. {
  394. value: 'user_preferences.out_of_office',
  395. label: 'Out of Office',
  396. description: 'To access the out of office personal setting.',
  397. },
  398. {
  399. value: 'user_preferences.password',
  400. label: 'Password',
  401. description: 'To access the change password personal setting.',
  402. },
  403. {
  404. value: 'user_preferences.two_factor_authentication',
  405. label: 'Two-factor Authentication',
  406. description:
  407. 'To access the two-factor authentication personal setting.',
  408. },
  409. {
  410. value: 'user_preferences.device',
  411. label: 'Devices',
  412. description: 'To access the devices personal setting.',
  413. },
  414. {
  415. value: 'user_preferences.access_token',
  416. label: 'Token Access',
  417. description: 'To access the API token personal setting.',
  418. },
  419. {
  420. value: 'user_preferences.linked_accounts',
  421. label: 'Linked Accounts',
  422. description: 'To access the linked accounts personal setting.',
  423. },
  424. {
  425. value: 'user_preferences.notifications',
  426. label: 'Notifications',
  427. description: 'To access the notifications personal setting.',
  428. },
  429. {
  430. value: 'user_preferences.overview_sorting',
  431. label: 'Overviews',
  432. description: 'To access the overviews personal setting.',
  433. },
  434. {
  435. value: 'user_preferences.calendar',
  436. label: 'Calendar',
  437. description: 'To access the calendar personal setting.',
  438. },
  439. ],
  440. },
  441. ]
  442. const treeselectOptions = [
  443. {
  444. value: 0,
  445. label: 'Item A',
  446. disabled: true,
  447. children: [
  448. {
  449. value: 1,
  450. label: 'Item 1',
  451. children: [
  452. {
  453. value: 2,
  454. label: 'Item I',
  455. },
  456. {
  457. value: 3,
  458. label: 'Item II',
  459. },
  460. {
  461. value: 4,
  462. label: 'Item III',
  463. },
  464. ],
  465. },
  466. {
  467. value: 5,
  468. label: 'Item 2',
  469. children: [
  470. ...[longOption.value],
  471. {
  472. value: 6,
  473. label: 'Item IV',
  474. },
  475. ],
  476. },
  477. {
  478. value: 7,
  479. label: 'Item 3',
  480. },
  481. ],
  482. },
  483. {
  484. value: 8,
  485. label: 'Item B',
  486. },
  487. {
  488. value: 9,
  489. label: 'Ítem C',
  490. },
  491. ]
  492. const buttonGroupOptions: CommonButtonItem[] = [
  493. {
  494. label: 'Button 1',
  495. variant: 'primary',
  496. icon: 'logo-flat',
  497. onActionClick: () => console.debug('Button 1 clicked'),
  498. },
  499. {
  500. label: 'Button 2',
  501. variant: 'secondary',
  502. },
  503. {
  504. label: 'Button 3',
  505. variant: 'tertiary',
  506. },
  507. {
  508. label: 'Button 4',
  509. variant: 'submit',
  510. },
  511. {
  512. label: 'Button 5',
  513. variant: 'danger',
  514. },
  515. {
  516. label: 'Button 6',
  517. variant: 'subtle',
  518. },
  519. {
  520. label: 'Button 7',
  521. variant: 'neutral',
  522. },
  523. ]
  524. const application = useApplicationStore()
  525. const formSchema = defineFormSchema([
  526. {
  527. type: 'editor',
  528. name: 'editor',
  529. label: 'Editor',
  530. required: true,
  531. },
  532. {
  533. isLayout: true,
  534. element: 'div',
  535. attrs: {
  536. class: 'grid md:grid-cols-2 gap-y-2.5 gap-x-3',
  537. },
  538. children: [
  539. {
  540. name: 'select_0',
  541. label: 'Column select',
  542. type: 'select',
  543. outerClass: 'col-span-1',
  544. props: {
  545. maxLength: 150,
  546. options: [...alphabetOptions.value, ...[longOption.value]],
  547. clearable: true,
  548. help: 'Testing',
  549. },
  550. },
  551. {
  552. name: 'toggle_1',
  553. label: 'Column toggle',
  554. type: 'toggle',
  555. outerClass: 'col-span-1',
  556. wrapperClass: 'md:mt-6',
  557. props: {
  558. variants: {
  559. true: 'yes',
  560. false: 'no',
  561. },
  562. },
  563. },
  564. {
  565. name: 'toggle_2',
  566. label: 'Row toggle',
  567. type: 'toggle',
  568. props: {
  569. variants: {
  570. true: 'yes',
  571. false: 'no',
  572. },
  573. },
  574. },
  575. ],
  576. },
  577. {
  578. type: 'security',
  579. name: 'security',
  580. label: 'Security',
  581. props: {
  582. securityAllowed: {
  583. SMIME: [],
  584. PGP: ['sign', 'encryption'],
  585. },
  586. securityDefaultOptions: {
  587. SMIME: ['sign', 'encryption'],
  588. PGP: ['sign'],
  589. },
  590. securityMessages: {
  591. SMIME: {
  592. sign: {
  593. message: 'The certificate for %s was not found.',
  594. messagePlaceholder: ['zammad@localhost'],
  595. },
  596. encryption: {
  597. message: 'The certificates for %s were not found.',
  598. messagePlaceholder: ['nicole.braun@zammad.org'],
  599. },
  600. },
  601. PGP: {
  602. sign: {
  603. message: 'The PGP key for %s was found.',
  604. messagePlaceholder: ['zammad@localhost'],
  605. },
  606. encryption: {
  607. message: 'The PGP keys for %s were found.',
  608. messagePlaceholder: ['nicole.braun@zammad.org'],
  609. },
  610. },
  611. },
  612. },
  613. value: { method: 'SMIME', options: [] },
  614. },
  615. {
  616. type: 'permissions',
  617. name: 'permissions',
  618. label: 'Permissions',
  619. props: {
  620. options: permissions,
  621. },
  622. value: ['ticket.agent'],
  623. },
  624. {
  625. type: 'autocomplete',
  626. name: 'autocomplete',
  627. label: 'Autocomplete',
  628. props: {
  629. clearable: true,
  630. gqlQuery: gql`
  631. query autocompleteSearchUser($input: AutocompleteSearchUserInput!) {
  632. autocompleteSearchUser(input: $input) {
  633. value
  634. label
  635. disabled
  636. icon
  637. }
  638. }
  639. `,
  640. },
  641. },
  642. {
  643. type: 'externalDataSource',
  644. name: 'external_data_source',
  645. label: 'External Data Source',
  646. object: EnumObjectManagerObjects.Ticket,
  647. help: 'Please add external_data_source attribute on Ticket object. Otherwise this field will not work.',
  648. },
  649. {
  650. type: 'agent',
  651. name: 'agent',
  652. label: 'Agent',
  653. props: {
  654. clearable: true,
  655. },
  656. },
  657. {
  658. type: 'ticket',
  659. name: 'ticket',
  660. label: 'Ticket',
  661. props: {
  662. clearable: true,
  663. },
  664. },
  665. {
  666. type: 'recipient',
  667. name: 'recipient',
  668. label: 'Recipient',
  669. props: {
  670. clearable: true,
  671. },
  672. },
  673. {
  674. type: 'recipient',
  675. name: 'recipient_multiple',
  676. label: 'Recipient (multiple)',
  677. props: {
  678. clearable: true,
  679. multiple: true,
  680. },
  681. },
  682. {
  683. type: 'customer',
  684. name: 'customer',
  685. label: 'Customer',
  686. props: {
  687. clearable: true,
  688. link: '/',
  689. linkIcon: 'person-add',
  690. },
  691. },
  692. {
  693. type: 'organization',
  694. name: 'organization',
  695. label: 'Organization',
  696. props: {
  697. clearable: true,
  698. options: [
  699. {
  700. value: 1,
  701. label: 'Zammad Foundation',
  702. organization: {
  703. active: true,
  704. },
  705. },
  706. ],
  707. },
  708. },
  709. {
  710. type: 'tags',
  711. name: 'tags',
  712. label: 'Tags',
  713. props: {
  714. clearable: true,
  715. canCreate: application.config.tag_new,
  716. },
  717. },
  718. {
  719. name: 'date_0',
  720. label: 'Date',
  721. type: 'date',
  722. props: {
  723. clearable: true,
  724. },
  725. },
  726. {
  727. name: 'date_1',
  728. label: 'Date range',
  729. type: 'date',
  730. props: {
  731. clearable: true,
  732. range: true,
  733. },
  734. },
  735. {
  736. name: 'datetime_0',
  737. label: 'Date/Time',
  738. type: 'datetime',
  739. props: {
  740. clearable: true,
  741. },
  742. },
  743. {
  744. name: 'group_permission_0',
  745. label: 'Group permissions',
  746. type: 'groupPermissions',
  747. props: {
  748. options: [
  749. {
  750. value: 1,
  751. label: 'Users',
  752. },
  753. {
  754. value: 2,
  755. label: 'some_group1',
  756. children: [
  757. {
  758. value: 3,
  759. label: 'Nested group',
  760. },
  761. ],
  762. },
  763. ],
  764. },
  765. },
  766. {
  767. type: 'select',
  768. name: 'select_1',
  769. label: 'Single select',
  770. props: {
  771. options: [...alphabetOptions.value, ...[longOption.value]],
  772. clearable: true,
  773. },
  774. },
  775. {
  776. type: 'select',
  777. name: 'select_2',
  778. label: 'Multi select',
  779. props: {
  780. multiple: true,
  781. options: [...alphabetOptions.value, ...[longOption.value]],
  782. clearable: true,
  783. },
  784. },
  785. {
  786. type: 'treeselect',
  787. name: 'treeselect_1',
  788. label: 'Single treeselect',
  789. props: {
  790. options: treeselectOptions,
  791. clearable: true,
  792. },
  793. },
  794. {
  795. type: 'treeselect',
  796. name: 'treeselect_2',
  797. label: 'Multi treeselect',
  798. props: {
  799. multiple: true,
  800. options: treeselectOptions,
  801. clearable: true,
  802. },
  803. },
  804. {
  805. type: 'toggleList',
  806. name: 'roles',
  807. label: 'Roles',
  808. props: {
  809. options: [
  810. { value: 3, label: 'name only' },
  811. { value: 1, label: 'Long name', description: 'Note here' },
  812. {
  813. value: 1111,
  814. label: 'Another long name',
  815. description: 'Note here again',
  816. },
  817. ],
  818. },
  819. },
  820. {
  821. type: 'radioList',
  822. name: 'radioRoles',
  823. label: 'Radio roles',
  824. value: 1,
  825. props: {
  826. options: [
  827. { value: 3, label: 'name only' },
  828. { value: 33333, label: 'name onlyyyy' },
  829. { value: 1, label: 'Long name', description: 'Note here' },
  830. {
  831. value: 1111,
  832. label: 'Another long name',
  833. description: 'Note here again',
  834. },
  835. ],
  836. },
  837. },
  838. {
  839. type: 'file',
  840. name: 'file',
  841. label: 'Attachment',
  842. props: {
  843. multiple: true,
  844. },
  845. },
  846. {
  847. type: 'toggleButtons',
  848. name: 'toggleButtons',
  849. label: 'Toggle Buttons',
  850. value: '1',
  851. props: {
  852. options: [
  853. { value: '3', label: 'name only' },
  854. { value: '33333', label: 'name onlyyyy' },
  855. { value: '1', label: 'Long name', icon: 'sun' },
  856. ],
  857. },
  858. },
  859. ])
  860. const formValues = ref()
  861. const formInitialValues: FormValues = {
  862. roles: [3, 1],
  863. // date_0: [new Date(), new Date(new Date().setDate(new Date().getDate() + 7))],
  864. }
  865. const progressBarValue = ref(0)
  866. const increaseProgressBar = () => {
  867. progressBarValue.value += 25
  868. }
  869. onMounted(() => {
  870. setInterval(increaseProgressBar, 2000)
  871. })
  872. watch(progressBarValue, (newValue) => {
  873. if (newValue < 100) return
  874. setTimeout(() => {
  875. progressBarValue.value = 0
  876. }, 1000)
  877. })
  878. const session = useSessionStore()
  879. const { user } = storeToRefs(session)
  880. const { isOpen: popoverIsOpen, popover, popoverTarget, toggle } = usePopover()
  881. const themeSwitchInstance = useTemplateRef('theme-switch')
  882. const cycleThemeSwitchValue = () => {
  883. themeSwitchInstance.value?.cycleValue()
  884. }
  885. const appearance = ref('auto')
  886. const schema: FormSchemaNode[] = [
  887. {
  888. type: 'text',
  889. name: 'code',
  890. label: 'Test',
  891. required: true,
  892. props: {
  893. help: 'Enter here something',
  894. },
  895. },
  896. ]
  897. const flyout = useFlyout({
  898. name: 'playground',
  899. component: () =>
  900. new Promise((resolve) => {
  901. return resolve(
  902. h(
  903. CommonFlyout,
  904. {
  905. onClose: () => {
  906. console.log(
  907. '%c %s',
  908. 'color: red; font-size: 16px',
  909. 'Flyout closed!',
  910. )
  911. },
  912. onAction: () => {
  913. console.log(
  914. '%c %s',
  915. 'color: green; font-size: 16px',
  916. 'Flyout action!',
  917. )
  918. },
  919. name: 'playground',
  920. headerTitle: 'Hello Playground',
  921. persistWidth: true,
  922. headerIcon: 'buildings',
  923. footerActionOptions: {
  924. actionLabel: 'Submit test',
  925. cancelLabel: 'Adios',
  926. actionButton: {
  927. type: 'submit',
  928. variant: 'primary',
  929. prefixIcon: 'check2',
  930. },
  931. },
  932. },
  933. {
  934. default: () => [
  935. h('div', { class: 'py-1' }, [
  936. h('input'),
  937. h(Form, { ref: 'flyoutForm', schema }),
  938. h('div', { class: 'w-[400px]', innerHTML: 'Hello world!' }),
  939. h(
  940. 'p',
  941. ' Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab laborum magnam omnis qui, ratione similique velit voluptatem. Cumque esse et, expedita inventore, iusto laboriosam magnam minus necessitatibus numquam odio odit optio quaerat, quidem quo quos reiciendis rem similique ut veniam vero. Aperiam at blanditiis dignissimos est et, ex harum id in itaque magni natus neque officia omnis perferendis quaerat, quasi ratione reiciendis sunt vitae voluptatum. At id obcaecati odio rerum sed! Accusamus aliquid assumenda cupiditate deleniti distinctio dolore dolores ea earum enim eos error esse ex expedita hic id incidunt iste laudantium molestias nisi obcaecati omnis placeat quam quibusdam quis, quod ratione rem repellendus reprehenderit sed sint soluta velit vitae voluptas voluptate voluptatem voluptates voluptatum. Delectus facilis nostrum praesentium quos sed. Ad assumenda atque cum cumque distinctio dolorem dolores excepturi explicabo harum impedit iusto labore, laboriosam laudantium libero minima nam pariatur quasi quisquam rem repellat reprehenderit saepe sapiente, tempora ut voluptates! Assumenda distinctio impedit veniam vitae voluptates! Aperiam, at commodi dignissimos ex exercitationem inventore quibusdam sequi veniam! A ab accusamus aperiam architecto atque beatae blanditiis commodi consequatur, deleniti deserunt dolor ducimus eaque ex excepturi illum incidunt ipsum laboriosam magni minus molestiae nam nesciunt nulla odit perferendis perspiciatis possimus quod quos similique sint suscipit temporibus unde veritatis voluptatibus? Ab ad, adipisci animi beatae ea eaque eligendi explicabo id impedit itaque magni mollitia nihil numquam obcaecati odit officia omnis perferendis porro quaerat quasi quod repellendus sint sunt suscipit, tenetur vel veniam. Ad animi architecto, aspernatur at blanditiis cumque delectus deleniti dolorem dolorum eos eum eveniet facilis fuga fugiat hic ipsam iure laboriosam maiores natus nisi nobis nulla officiis optio perferendis porro quaerat quam qui quo, repellat sed similique sint suscipit tenetur ullam veritatis vitae voluptates. A ad illo minima nisi nobis vitae voluptatem? Autem deleniti error maiores minus pariatur porro quidem suscipit!',
  942. ),
  943. ]),
  944. ],
  945. },
  946. ),
  947. )
  948. }),
  949. })
  950. const dialog = useDialog({
  951. name: 'playground',
  952. component: () =>
  953. new Promise((resolve) => {
  954. return resolve(
  955. h(CommonDialog, {
  956. name: 'playground',
  957. headerTitle: 'Confirmation',
  958. content: 'Do you want to continue?',
  959. }),
  960. )
  961. }),
  962. })
  963. const { waitForVariantConfirmation } = useConfirmation()
  964. const deleteTest = async () => {
  965. const confirmed = await waitForVariantConfirmation('delete')
  966. if (confirmed) {
  967. console.log('Item deleted!')
  968. } else {
  969. console.log('Item not deleted!')
  970. }
  971. }
  972. const vip = ref(false)
  973. const tableHeaders = [
  974. {
  975. key: 'name',
  976. label: 'User name',
  977. },
  978. {
  979. key: 'title',
  980. label: 'Job position',
  981. truncate: true,
  982. },
  983. {
  984. key: 'email',
  985. label: 'Email',
  986. },
  987. {
  988. key: 'role',
  989. label: 'Role',
  990. },
  991. ]
  992. const tableItems = reactive([
  993. {
  994. id: 1,
  995. name: 'Lindsay Walton',
  996. title: 'Front-end Developer',
  997. email: 'lindsay.walton@example.com',
  998. role: 'Member',
  999. },
  1000. {
  1001. id: 2,
  1002. name: 'Courtney Henry',
  1003. title: 'Designer',
  1004. email: 'courtney.henry@example.com',
  1005. role: 'Admin',
  1006. },
  1007. {
  1008. id: 3,
  1009. name: 'Tom Cook',
  1010. title: 'Director of Product',
  1011. email: 'tom.cook@example.com',
  1012. role: 'Member',
  1013. },
  1014. {
  1015. id: 4,
  1016. name: 'Whitney Francis',
  1017. title: 'Copywriter',
  1018. email: 'whitney.francis@example.com',
  1019. role: 'Admin',
  1020. },
  1021. {
  1022. id: 5,
  1023. name: 'Leonard Krasner',
  1024. title: 'Senior Designer Principal Designer ',
  1025. email: 'leonard.krasner@example.com',
  1026. role: 'Owner',
  1027. },
  1028. {
  1029. id: 6,
  1030. name: 'Floyd Miles',
  1031. title:
  1032. 'Principal Designer for a very long way to go to see the end of the title. It is a very long title, indeed.',
  1033. email: 'floyd.miles@example.com',
  1034. role: 'Member',
  1035. },
  1036. ])
  1037. const tableActions: MenuItem[] = [
  1038. {
  1039. key: 'delete',
  1040. label: 'Delete this row',
  1041. icon: 'trash3',
  1042. show: (data) => !!data?.role,
  1043. onClick: (data) => {
  1044. console.log(data)
  1045. },
  1046. },
  1047. {
  1048. key: 'download',
  1049. label: 'Download this row',
  1050. icon: 'download',
  1051. onClick: (data) => {
  1052. console.log(data)
  1053. },
  1054. },
  1055. ]
  1056. const changeRow = () => {
  1057. tableItems[0].role = tableItems[0].role ? '' : 'Member'
  1058. }
  1059. const { activeTab } = useTabManager<string>()
  1060. const { activeTab: activeFilters } = useTabManager<string[]>()
  1061. const popoverOrientation: Ref<Orientation> = ref('autoVertical')
  1062. const popoverOrientationOptions = [
  1063. {
  1064. value: 'autoVertical',
  1065. label: 'Auto vertical',
  1066. },
  1067. {
  1068. value: 'autoHorizontal',
  1069. label: 'Auto horizontal',
  1070. },
  1071. {
  1072. value: 'top',
  1073. label: 'Top',
  1074. },
  1075. {
  1076. value: 'bottom',
  1077. label: 'Bottom',
  1078. },
  1079. {
  1080. value: 'left',
  1081. label: 'Left',
  1082. },
  1083. {
  1084. value: 'right',
  1085. label: 'Right',
  1086. },
  1087. ]
  1088. const popoverPlacement: Ref<Placement> = ref('start')
  1089. const popoverPlacementOptions = [
  1090. {
  1091. value: 'start',
  1092. label: 'Start',
  1093. },
  1094. {
  1095. value: 'arrowStart',
  1096. label: 'Arrow Start',
  1097. },
  1098. {
  1099. value: 'arrowEnd',
  1100. label: 'Arrow End',
  1101. },
  1102. {
  1103. value: 'end',
  1104. label: 'End',
  1105. },
  1106. ]
  1107. const breadcrumbItems = [
  1108. {
  1109. label: 'Tickets',
  1110. icon: 'logo-flat',
  1111. },
  1112. {
  1113. label: '123456',
  1114. route: 'tickets/1',
  1115. },
  1116. ]
  1117. const popoverHideArrow = ref(false)
  1118. const inlineEditValue = ref('Edit me inline')
  1119. </script>
  1120. <template>
  1121. <LayoutContent :breadcrumb-items="[]">
  1122. <div>
  1123. <div class="w-1/2">
  1124. <h1 id="test" v-tooltip="'Hello world'" class="w-fit">
  1125. Tooltip example
  1126. </h1>
  1127. <h2 title="Buttons" class="text-xl">Buttons</h2>
  1128. <h3 v-tooltip="'another example'">Text only</h3>
  1129. <div class="flex space-x-3 py-2">
  1130. <CommonButton variant="primary" />
  1131. <CommonButton variant="secondary" />
  1132. <CommonButton variant="tertiary" />
  1133. <CommonButton variant="submit" />
  1134. <CommonButton variant="danger" />
  1135. <CommonButton variant="subtle" />
  1136. <CommonButton variant="neutral" />
  1137. </div>
  1138. <h3>With icon</h3>
  1139. <div class="flex space-x-3 py-2">
  1140. <CommonButton variant="primary" prefix-icon="logo-flat" />
  1141. <CommonButton variant="secondary" prefix-icon="logo-flat" />
  1142. <CommonButton variant="tertiary" prefix-icon="logo-flat" />
  1143. <CommonButton variant="submit" prefix-icon="logo-flat" />
  1144. <CommonButton variant="danger" prefix-icon="logo-flat" />
  1145. <CommonButton variant="subtle" prefix-icon="logo-flat" />
  1146. <CommonButton variant="neutral" prefix-icon="logo-flat" />
  1147. </div>
  1148. <h3>Icon only</h3>
  1149. <div class="flex items-center space-x-3 py-2">
  1150. <CommonButton variant="primary" icon="logo-flat" />
  1151. <CommonButton variant="secondary" icon="logo-flat" />
  1152. <CommonButton variant="tertiary" icon="logo-flat" />
  1153. <CommonButton variant="submit" icon="logo-flat" />
  1154. <CommonButton variant="danger" icon="logo-flat" />
  1155. <CommonButton variant="subtle" icon="logo-flat" />
  1156. <CommonButton variant="neutral" icon="logo-flat" />
  1157. <CommonButton variant="primary" icon="logo-flat" size="medium" />
  1158. <CommonButton variant="secondary" icon="logo-flat" size="medium" />
  1159. <CommonButton variant="tertiary" icon="logo-flat" size="medium" />
  1160. <CommonButton variant="submit" icon="logo-flat" size="medium" />
  1161. <CommonButton variant="danger" icon="logo-flat" size="medium" />
  1162. <CommonButton variant="subtle" icon="logo-flat" size="medium" />
  1163. <CommonButton variant="neutral" icon="logo-flat" size="medium" />
  1164. <CommonButton variant="primary" icon="logo-flat" size="large" />
  1165. <CommonButton variant="secondary" icon="logo-flat" size="large" />
  1166. <CommonButton variant="tertiary" icon="logo-flat" size="large" />
  1167. <CommonButton variant="submit" icon="logo-flat" size="large" />
  1168. <CommonButton variant="danger" icon="logo-flat" size="large" />
  1169. <CommonButton variant="subtle" icon="logo-flat" size="large" />
  1170. <CommonButton variant="neutral" icon="logo-flat" size="large" />
  1171. </div>
  1172. <h3>Misc</h3>
  1173. <div class="flex-wrap space-x-3 space-y-2 py-2">
  1174. <CommonButton variant="submit" block>Block</CommonButton>
  1175. <CommonButton variant="primary" disabled>Disabled</CommonButton>
  1176. <CommonButton variant="secondary" disabled>Disabled</CommonButton>
  1177. <CommonButton variant="tertiary" disabled>Disabled</CommonButton>
  1178. <CommonButton variant="submit" disabled>Disabled</CommonButton>
  1179. <CommonButton variant="danger" disabled>Disabled</CommonButton>
  1180. <CommonButton variant="subtle" disabled>Disabled</CommonButton>
  1181. <CommonButton variant="neutral" disabled>Disabled</CommonButton>
  1182. </div>
  1183. <h3>Group</h3>
  1184. <div class="w-1/2 space-x-3 space-y-2 py-2">
  1185. <CommonButtonGroup :items="buttonGroupOptions" />
  1186. </div>
  1187. </div>
  1188. <div class="flex">
  1189. <CommonBreadcrumb class="grow" :items="breadcrumbItems">
  1190. <template #trailing>
  1191. <CommonIcon
  1192. name="files"
  1193. size="xs"
  1194. class="text-blue-800"
  1195. @click="copyToClipboard('123456')"
  1196. />
  1197. </template>
  1198. </CommonBreadcrumb>
  1199. </div>
  1200. <div class="w-1/2">
  1201. <h2 class="text-xl">Alerts</h2>
  1202. <CommonAlert variant="info" dismissible class="mb-2.5"
  1203. >It's Friday!
  1204. </CommonAlert>
  1205. <CommonAlert variant="success" class="mb-2.5">
  1206. <div class="flex flex-col gap-1.5">
  1207. <CommonLabel class="text-yellow-600" size="large"
  1208. >Similar tickets found</CommonLabel
  1209. >
  1210. <CommonLabel class="text-yellow-600"
  1211. >Tickets with the same attributes were found.</CommonLabel
  1212. >
  1213. <ul class="list-inside list-disc">
  1214. <li>31001 Test Ticket</li>
  1215. </ul>
  1216. </div>
  1217. </CommonAlert>
  1218. <CommonAlert variant="warning" class="mb-2.5"
  1219. >Heee! You're typing too fast.
  1220. </CommonAlert>
  1221. <CommonAlert variant="danger" class="mb-2.5"
  1222. >Ooops! You broke it.
  1223. </CommonAlert>
  1224. </div>
  1225. <div>
  1226. <h2>Labels</h2>
  1227. <CommonLabel size="small" prefix-icon="logo" suffix-icon="logo-flat">
  1228. Small
  1229. </CommonLabel>
  1230. <br />
  1231. <CommonLabel size="medium" prefix-icon="logo" suffix-icon="logo-flat">
  1232. Medium
  1233. </CommonLabel>
  1234. <br />
  1235. <CommonLabel size="large" prefix-icon="logo" suffix-icon="logo-flat">
  1236. Large
  1237. </CommonLabel>
  1238. <br />
  1239. <CommonLabel size="xl" prefix-icon="logo" suffix-icon="logo-flat">
  1240. Extra large
  1241. </CommonLabel>
  1242. </div>
  1243. <div>
  1244. <h2>Badges</h2>
  1245. <CommonBadge class="ltr:mr-2 rtl:ml-2" variant="neutral">
  1246. Neutral
  1247. </CommonBadge>
  1248. <CommonBadge class="ltr:mr-2 rtl:ml-2" variant="info">Info</CommonBadge>
  1249. <CommonBadge class="ltr:mr-2 rtl:ml-2" variant="success">
  1250. Success
  1251. </CommonBadge>
  1252. <CommonBadge class="ltr:mr-2 rtl:ml-2" variant="warning">
  1253. Warning
  1254. </CommonBadge>
  1255. <CommonBadge class="ltr:mr-2 rtl:ml-2" variant="danger">
  1256. Danger
  1257. </CommonBadge>
  1258. <CommonBadge
  1259. class="bg-pink-300 text-white ltr:mr-2 rtl:ml-2 dark:bg-pink-300"
  1260. variant="custom"
  1261. >Custom
  1262. </CommonBadge>
  1263. </div>
  1264. <div class="w-1/5">
  1265. <h2>Progress Bar</h2>
  1266. <div class="flex flex-col gap-3">
  1267. <div class="flex flex-col gap-2">
  1268. <CommonLabel size="small">What is the meaning of life?</CommonLabel>
  1269. <CommonProgressBar />
  1270. </div>
  1271. <div class="flex items-end gap-2">
  1272. <div class="mb-1 flex grow flex-col gap-1">
  1273. <div class="flex justify-between">
  1274. <CommonLabel size="small">Organizations</CommonLabel>
  1275. <CommonLabel
  1276. class="text-stone-200 dark:text-neutral-500"
  1277. size="small"
  1278. >
  1279. {{ progressBarValue }} of 100
  1280. </CommonLabel>
  1281. </div>
  1282. <CommonProgressBar
  1283. :value="progressBarValue.toString()"
  1284. max="100"
  1285. />
  1286. </div>
  1287. <CommonIcon
  1288. class="shrink-0 fill-green-500"
  1289. :class="progressBarValue !== 100 ? 'invisible' : undefined"
  1290. name="check2"
  1291. size="tiny"
  1292. decorative
  1293. />
  1294. </div>
  1295. </div>
  1296. </div>
  1297. <h2 class="mb-2 mt-8">Table</h2>
  1298. <div class="mb-6 flex flex-col gap-4">
  1299. <CommonButton variant="primary" @click="changeRow()"
  1300. >Change row</CommonButton
  1301. >
  1302. <CommonSimpleTable
  1303. :headers="tableHeaders"
  1304. :items="tableItems"
  1305. :actions="tableActions"
  1306. ></CommonSimpleTable>
  1307. </div>
  1308. <div class="w-1/2">
  1309. <h2 class="text-lg">Avatar</h2>
  1310. <div class="my-4 flex items-center gap-4">
  1311. <CommonUserAvatar
  1312. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1313. tabindex="0"
  1314. :entity="{
  1315. id: 'gid://zammad/User/1',
  1316. vip,
  1317. }"
  1318. size="medium"
  1319. />
  1320. <CommonButton
  1321. :variant="vip ? 'neutral' : 'subtle'"
  1322. @click="vip = !vip"
  1323. >
  1324. {{ vip ? 'Make us unimportant :(' : 'Make us important :)' }}
  1325. </CommonButton>
  1326. </div>
  1327. <div class="flex gap-4">
  1328. <CommonUserAvatar
  1329. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1330. tabindex="0"
  1331. :entity="{
  1332. id: 'gid://zammad/User/2',
  1333. firstname: 'Alfa',
  1334. lastname: 'Bravo',
  1335. vip,
  1336. }"
  1337. size="xs"
  1338. />
  1339. <CommonUserAvatar
  1340. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1341. tabindex="0"
  1342. :entity="{
  1343. id: 'gid://zammad/User/3',
  1344. firstname: 'Charlie',
  1345. lastname: 'Delta',
  1346. vip,
  1347. }"
  1348. size="small"
  1349. />
  1350. <CommonUserAvatar
  1351. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1352. tabindex="0"
  1353. :entity="{
  1354. id: 'gid://zammad/User/4',
  1355. firstname: 'Echo',
  1356. lastname: 'Foxtrot',
  1357. vip,
  1358. }"
  1359. size="medium"
  1360. />
  1361. <CommonUserAvatar
  1362. class="cursor-pointer outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1363. tabindex="0"
  1364. :entity="{
  1365. id: 'gid://zammad/User/5',
  1366. firstname: 'Golf',
  1367. lastname: 'Hotel',
  1368. vip,
  1369. }"
  1370. size="normal"
  1371. />
  1372. <CommonUserAvatar
  1373. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1374. tabindex="0"
  1375. :entity="{
  1376. id: 'gid://zammad/User/6',
  1377. firstname: 'India',
  1378. lastname: 'Juliett',
  1379. vip,
  1380. }"
  1381. size="large"
  1382. />
  1383. <CommonUserAvatar
  1384. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1385. tabindex="0"
  1386. :entity="{
  1387. id: 'gid://zammad/User/7',
  1388. firstname: 'Kilo',
  1389. lastname: 'Lima',
  1390. vip,
  1391. }"
  1392. size="xl"
  1393. />
  1394. </div>
  1395. </div>
  1396. <div>
  1397. <h2 class="text-lg">Popover</h2>
  1398. <div class="mb-2 flex gap-2">
  1399. <FormKit
  1400. v-model="popoverOrientation"
  1401. type="select"
  1402. name="orientation"
  1403. :options="popoverOrientationOptions"
  1404. />
  1405. <FormKit
  1406. v-model="popoverPlacement"
  1407. type="select"
  1408. name="placement"
  1409. :options="popoverPlacementOptions"
  1410. />
  1411. <FormKit
  1412. v-model="popoverHideArrow"
  1413. type="toggle"
  1414. name="placement"
  1415. label="Hide arrow"
  1416. :variants="{ true: 'yes', false: 'no' }"
  1417. />
  1418. </div>
  1419. <template v-if="user">
  1420. <CommonPopover
  1421. ref="popover"
  1422. :owner="popoverTarget"
  1423. :orientation="popoverOrientation"
  1424. :placement="popoverPlacement"
  1425. :hide-arrow="popoverHideArrow"
  1426. >
  1427. <CommonPopoverMenu
  1428. :popover="popover"
  1429. header-label="Erika Mustermann"
  1430. :items="[
  1431. {
  1432. key: 'appearance',
  1433. label: 'Appearance',
  1434. icon: 'brightness-alt-high',
  1435. noCloseOnClick: true,
  1436. onClick: cycleThemeSwitchValue,
  1437. },
  1438. {
  1439. key: 'keyboard-shortcuts',
  1440. label: 'Keyboard shortcuts',
  1441. onClick: () => {
  1442. console.log('OPEN KEYBOARD SHORTCUTS DIALOG')
  1443. },
  1444. icon: 'keyboard',
  1445. },
  1446. {
  1447. key: 'personal-setting',
  1448. label: 'Profile settings',
  1449. link: '/personal-setting',
  1450. icon: 'person-gear',
  1451. },
  1452. {
  1453. key: 'sign-out',
  1454. label: 'Sign out',
  1455. link: '/logout',
  1456. icon: 'box-arrow-in-right',
  1457. separatorTop: true,
  1458. },
  1459. ]"
  1460. >
  1461. <template #itemRight-appearance>
  1462. <div class="flex items-center px-2">
  1463. <ThemeSwitch
  1464. ref="theme-switch"
  1465. v-model="appearance"
  1466. size="small"
  1467. />
  1468. </div>
  1469. </template>
  1470. </CommonPopoverMenu>
  1471. </CommonPopover>
  1472. <button
  1473. ref="popoverTarget"
  1474. class="-:outline-transparent hover:-:outline-blue-900 rounded-full outline outline-2 focus:outline-blue-800 hover:focus:outline-blue-800"
  1475. :class="{
  1476. 'outline-blue-800 hover:outline-blue-800': popoverIsOpen,
  1477. }"
  1478. @click="toggle(true)"
  1479. >
  1480. <CommonUserAvatar :entity="user" size="large" personal />
  1481. </button>
  1482. </template>
  1483. </div>
  1484. <section>
  1485. <h2>Common Action Menu</h2>
  1486. <CommonActionMenu
  1487. :entity="{ id: 'test-me', name: 'playground' }"
  1488. :actions="[
  1489. {
  1490. key: 'delete-customer',
  1491. label: 'Delete Customer',
  1492. variant: 'danger',
  1493. icon: 'trash3',
  1494. onClick: (data) => {
  1495. console.log(data?.id, data?.name, 'Delete customer')
  1496. },
  1497. },
  1498. {
  1499. key: 'change-customer',
  1500. label: 'Change Customer',
  1501. icon: 'person-gear',
  1502. onClick: (data) => {
  1503. console.log(data?.id, data?.name, 'Change customer')
  1504. },
  1505. },
  1506. ]"
  1507. />
  1508. <h3>Single Action Item</h3>
  1509. <CommonActionMenu
  1510. :entity="{ id: 'test-me', name: 'playground' }"
  1511. :actions="[
  1512. {
  1513. key: 'change-customer',
  1514. label: 'Change Customer',
  1515. icon: 'person-gear',
  1516. onClick: (id) => {
  1517. console.log(id, 'Delete customer')
  1518. },
  1519. },
  1520. ]"
  1521. />
  1522. </section>
  1523. <div>
  1524. <span> Inline Edit </span>
  1525. <CommonInlineEdit
  1526. id="test"
  1527. :value="inlineEditValue"
  1528. @submit-edit="
  1529. (value) => {
  1530. inlineEditValue = value
  1531. }
  1532. "
  1533. />
  1534. </div>
  1535. <div class="w-1/2">
  1536. <h2 class="mb-2 mt-8">Flyout and Dialog</h2>
  1537. <div class="mb-6 flex gap-4">
  1538. <CommonButton variant="tertiary" @click="dialog.open()"
  1539. >Show Dialog
  1540. </CommonButton>
  1541. <CommonButton variant="primary" @click="flyout.open()">
  1542. Open Flyout
  1543. </CommonButton>
  1544. </div>
  1545. <h2 class="mb-2">Confirmation</h2>
  1546. <div class="mb-6 flex gap-4">
  1547. <CommonButton variant="tertiary" @click="deleteTest()"
  1548. >Delete
  1549. </CommonButton>
  1550. </div>
  1551. <h2 class="mb-2 mt-8">Input Copy To Clipboard</h2>
  1552. <div class="mb-6">
  1553. <CommonInputCopyToClipboard
  1554. value="some text to copy"
  1555. label="A label"
  1556. />
  1557. </div>
  1558. </div>
  1559. <div class="w-1/2">
  1560. <h2 class="text-lg">Form</h2>
  1561. <Form
  1562. id="playground-form"
  1563. v-model="formValues"
  1564. form-class="mb-2.5 space-y-2.5"
  1565. :schema="formSchema"
  1566. :initial-values="formInitialValues"
  1567. @submit="console.debug($event)"
  1568. >
  1569. <template #after-fields>
  1570. <div class="my-5 flex items-center justify-end gap-2">
  1571. <CommonButton
  1572. variant="secondary"
  1573. size="medium"
  1574. @click="reset('playground-form')"
  1575. >
  1576. Reset
  1577. </CommonButton>
  1578. <CommonButton variant="submit" type="submit" size="medium">
  1579. Submit
  1580. </CommonButton>
  1581. </div>
  1582. </template>
  1583. </Form>
  1584. <pre
  1585. class="flex flex-wrap gap-5 text-wrap rounded-lg bg-blue-200 p-5 font-mono text-sm text-gray-100 dark:bg-gray-700 dark:text-neutral-400"
  1586. >{{ formValues }}</pre
  1587. >
  1588. </div>
  1589. <h3>Tabs Groups</h3>
  1590. <CommonTabManager
  1591. v-model="activeTab"
  1592. :tabs="[
  1593. { label: 'Tab 1', key: 'tab-1' },
  1594. { label: 'Tab 2', default: true, key: 'tab-2' },
  1595. { label: 'Tab 3', key: 'tab-3' },
  1596. ]"
  1597. />
  1598. <h3>Filter Selector</h3>
  1599. <CommonTabManager
  1600. v-model="activeFilters"
  1601. label="Roles"
  1602. :tabs="[
  1603. { label: 'Admin', key: 'admin' },
  1604. { label: 'Agent', key: 'agent' },
  1605. { label: 'Customer', key: 'customer' },
  1606. ]"
  1607. multiple
  1608. />
  1609. </div>
  1610. </LayoutContent>
  1611. </template>