@burh/nuxt-core 1.0.500 → 1.0.501

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -223,9 +223,23 @@
223
223
  v-for="(item, index) in orderByDate(companyHistory())"
224
224
  :key="index"
225
225
  >
226
- <p class="history-text mb-0">
227
- {{ item.text }}
228
- </p>
226
+ <div class="d-flex align-items-center justify-content-between">
227
+ <p class="history-text mb-0" v-html="item.text" />
228
+
229
+ <el-tooltip
230
+ placement="top"
231
+ content="Baixar PDF"
232
+ >
233
+ <button
234
+ v-if="item.hasDownload"
235
+ class="py-2 px-3 mx-2 border-0 bg-transparent text-primary"
236
+ @click="() => downloadPdf(item)"
237
+ >
238
+ <i class="fas fa-download" />
239
+ </button>
240
+ </el-tooltip>
241
+ </div>
242
+
229
243
  <span>{{ item.date | convertDate }}</span>
230
244
  </div>
231
245
  <p v-if="companyHistory().length === 0" class="history-text">
@@ -729,20 +743,61 @@ export default {
729
743
  cleatInput() {
730
744
  this.newNote = '';
731
745
  },
746
+ async downloadPdf(param) {
747
+ let data = await this.$store.app.$services.testOnline.downloadPdf(
748
+ param.id
749
+ );
750
+
751
+ const url = window.URL.createObjectURL(data.data);
752
+ const link = document.createElement('a');
753
+ link.href = url;
754
+ link.setAttribute(
755
+ 'download',
756
+ `${param.user.name}-${param.test.name}.pdf`
757
+ );
758
+ document.body.appendChild(link);
759
+ link.click();
760
+ link.remove();
761
+ window.URL.revokeObjectURL(url);
762
+ },
763
+ getTestHistory() {
764
+ const tests = this.userData.tests.map(test => {
765
+ if (!test.finished_at) {
766
+ return;
767
+ }
768
+
769
+ const testData = {
770
+ avarage: test.avarage,
771
+ date: test.finished_at,
772
+ text: `Finalizou o teste ${test.test.name.toUpperCase()} com nota <b>${test.avarage}</b>`
773
+ };
774
+
775
+ return testData;
776
+ }).filter(item => item);
777
+
778
+ return tests;
779
+ },
732
780
  companyHistory() {
733
781
  let tests = this.userData.tests.map(x => {
782
+ let test = {
783
+ id: x.id,
784
+ date: x.finished_at,
785
+ user: {
786
+ name: this.userData.name
787
+ },
788
+ test: {
789
+ name: x.test.name
790
+ }
791
+ };
792
+
734
793
  if (x.finished_at) {
735
- return {
736
- date: x.finished_at,
737
- text: `Finalizou o teste ${x.test.name.toUpperCase()}`
738
- };
794
+ test.text = `Finalizou o teste ${x.test.name.toUpperCase()} com nota <b>${x.avarage}</b>`;
795
+ test.hasDownload = true;
739
796
  } else {
740
- return {
741
- date: x.created_at,
742
- text: `Recebeu o teste ${x.test.name.toUpperCase()}`
743
- };
797
+ test.text = `Recebeu o teste ${x.test.name.toUpperCase()}`;
744
798
  }
745
799
 
800
+ return test;
746
801
  });
747
802
 
748
803
  let courses = this.userData.courses_user.map(x => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.500",
3
+ "version": "1.0.501",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {