{"version":3,"file":"UniqueSongs-DuPiSqER.js","sources":["../../Vue/src/pages/Activity/UniqueSongs.vue"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport { UniqueSongActivityData } from \"@/models/UniqueSongActivityData\";\r\nimport { LoadStatus } from \"@/models/frontend-only/LoadStatus\";\r\n\r\nconst busy = useBusyStore();\r\nconst api = useApiStore();\r\nconst dateStore = useDateStore();\r\nconst status = ref<LoadStatus>(LoadStatus.Loading);\r\nconst modals = useModalStore();\r\n\r\nconst data = ref<UniqueSongActivityData | null>(null);\r\n\r\nconst maxUniqueSongsAllowed = computed(\r\n  () => data.value?.maxUniqueSongsAllowed || 0,\r\n);\r\nconst dateRangeStart = computed(\r\n  () => (data.value && dateStore.formatDate(data.value.dateStart)) || \"\",\r\n);\r\nconst dateRangeEnd = computed(\r\n  () => (data.value && dateStore.formatDate(data.value.dateEnd)) || \"\",\r\n);\r\nconst songs = computed(() => data.value?.songs || []);\r\nconst maxedOutUniqueSongUsage = computed(\r\n  () => data.value && data.value.songs.length >= maxUniqueSongsAllowed.value,\r\n);\r\n\r\nonMounted(async () => {\r\n  busy.showBusy();\r\n  try {\r\n    data.value = (await api.get(\r\n      \"/GetActivityUniqueSongs\",\r\n    )) as UniqueSongActivityData;\r\n    status.value = LoadStatus.Ready;\r\n  } catch (err) {\r\n    status.value = LoadStatus.Error;\r\n    throw err;\r\n  }\r\n  busy.hideBusy();\r\n});\r\n</script>\r\n\r\n<template>\r\n  <Card no-body>\r\n    <div\r\n      v-if=\"status === LoadStatus.Ready\"\r\n      class=\"px-7 py-5\"\r\n    >\r\n      <p>\r\n        <i18n-t\r\n          keypath=\"SV.MES_UniqueSongsUsed\"\r\n          scope=\"global\"\r\n        >\r\n          <template #startdate>\r\n            {{ dateRangeStart }}\r\n          </template>\r\n          <template #enddate>\r\n            {{ dateRangeEnd }}\r\n          </template>\r\n          <template #songcount>\r\n            <strong>{{\r\n              $t(\"SV.LIT_UniqueSongsUsed_SongCount\", {\r\n                count: songs.length,\r\n                max: maxUniqueSongsAllowed,\r\n              })\r\n            }}</strong>\r\n          </template>\r\n        </i18n-t>\r\n        <button\r\n          type=\"button\"\r\n          :aria-label=\"$t('SV.LIT_MoreInformationAboutUniqueSongs')\"\r\n          class=\"ml-2 text-primary\"\r\n          @click=\"modals.showModal('UniqueSongsAboutModal')\"\r\n        >\r\n          <FAIcon class=\"fa-light fa-info-circle\" />\r\n        </button>\r\n      </p>\r\n      <div v-if=\"maxedOutUniqueSongUsage\">\r\n        <p class=\"mb-1\">\r\n          <i18n-t\r\n            keypath=\"SV.MES_CapacityLimitsReachedModalMsgLink\"\r\n            tag=\"span\"\r\n            scope=\"global\"\r\n          >\r\n            <template #songs>{{ $t(\"SV.LIT_SongsYouveAlreadyUsed\") }}</template>\r\n            <template #contact>\r\n              <a\r\n                ref=\"contactLink\"\r\n                href=\"https://ccli.com/contact-ccli\"\r\n                target=\"_blank\"\r\n                >{{ $t(\"G.LIT_contactus\") }}</a\r\n              >\r\n            </template>\r\n          </i18n-t>\r\n        </p>\r\n      </div>\r\n      <div v-if=\"!songs.length\">\r\n        <p>{{ $t(\"S.LIT_ThereAreNoUniqueSongsToShowYetTitle\") }}</p>\r\n        <p class=\"mb-1\">{{ $t(\"S.MES_ThereAreNoUniqueSongsToShowMsg\") }}</p>\r\n      </div>\r\n    </div>\r\n    <div\r\n      v-else\r\n      class=\"px-7 py-5\"\r\n    >\r\n      <span\r\n        class=\"placeholder\"\r\n        style=\"width: 300px\"\r\n      />\r\n    </div>\r\n\r\n    <SongListClientSidePagination\r\n      :songs=\"songs\"\r\n      :loading-number=\"status !== LoadStatus.Ready ? 10 : null\"\r\n    />\r\n  </Card>\r\n</template>\r\n\r\n<style scoped lang=\"postcss\"></style>\r\n"],"names":["busy","useBusyStore","api","useApiStore","dateStore","useDateStore","status","ref","LoadStatus","modals","useModalStore","data","maxUniqueSongsAllowed","computed","_a","dateRangeStart","dateRangeEnd","songs","maxedOutUniqueSongUsage","onMounted","err"],"mappings":"w1CAIA,MAAMA,EAAOC,IACPC,EAAMC,IACNC,EAAYC,IACZC,EAASC,EAAgBC,EAAW,OAAO,EAC3CC,EAASC,IAETC,EAAOJ,EAAmC,IAAI,EAE9CK,EAAwBC,EAC5B,WAAM,QAAAC,EAAAH,EAAK,QAAL,YAAAG,EAAY,wBAAyB,EAAA,EAEvCC,EAAiBF,EACrB,IAAOF,EAAK,OAASP,EAAU,WAAWO,EAAK,MAAM,SAAS,GAAM,EAAA,EAEhEK,EAAeH,EACnB,IAAOF,EAAK,OAASP,EAAU,WAAWO,EAAK,MAAM,OAAO,GAAM,EAAA,EAE9DM,EAAQJ,EAAS,IAAM,OAAA,QAAAC,EAAAH,EAAK,QAAL,YAAAG,EAAY,QAAS,CAAA,EAAE,EAC9CI,EAA0BL,EAC9B,IAAMF,EAAK,OAASA,EAAK,MAAM,MAAM,QAAUC,EAAsB,KAAA,EAGvE,OAAAO,EAAU,SAAY,CACpBnB,EAAK,SAAS,EACV,GAAA,CACGW,EAAA,MAAS,MAAMT,EAAI,IACtB,yBAAA,EAEFI,EAAO,MAAQE,EAAW,YACnBY,EAAK,CACZ,MAAAd,EAAO,MAAQE,EAAW,MACpBY,CACR,CACApB,EAAK,SAAS,CAAA,CACf"}