| 1 |
import { createApp } from "vue"; |
| 2 |
import store from './store' |
| 3 |
var j = jQuery.noConflict() |
| 4 |
import TemplatesLibrary from '../Components/TemplatesLibrary' |
| 5 |
|
| 6 |
if(document.getElementById("templates-library")){ |
| 7 |
const app = createApp(TemplatesLibrary); |
| 8 |
app.config.globalProperties.$store = store |
| 9 |
app.mount("#templates-library"); |
| 10 |
store.actions.initializeStore() |
| 11 |
} |
| 12 |
|
| 13 |
j(document).ready(function (j) { |
| 14 |
|
| 15 |
let TemplateLibrary = function() { |
| 16 |
j('#wpfnl-tab-create_funnel, .add-new-funnel-btn').on('click', this.showTemplateLibrary) |
| 17 |
j('.wpfnl-modal-close').on('click', this.closeTemplateLibraryModal) |
| 18 |
j('#create-first-step, #add-new-step').on('click', this.getStepTemplates) |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* show template library |
| 23 |
* |
| 24 |
* @param e |
| 25 |
*/ |
| 26 |
TemplateLibrary.prototype.showTemplateLibrary = function(e) { |
| 27 |
e.preventDefault(); |
| 28 |
j('#create-funnel-loader').addClass('show'); |
| 29 |
j('#template-library-modal').show(); |
| 30 |
j('#wpfnl-create-funnel__inner-content').show(); |
| 31 |
j('#wpfnl-create-steps_inner-content').hide(); |
| 32 |
|
| 33 |
j('.wpfnl-dashboard__header:not(.create-funnel__header)').hide(); |
| 34 |
j('.wpfnl-dashboard__inner-content').hide(); |
| 35 |
j('.wpfnl-funnel-settings__inner-content').hide(); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* show template library |
| 40 |
* |
| 41 |
* @param e |
| 42 |
*/ |
| 43 |
TemplateLibrary.prototype.TemplateShowLibrary = function() { |
| 44 |
|
| 45 |
j('#create-funnel-loader').addClass('show'); |
| 46 |
j('#template-library-modal').show(); |
| 47 |
j('#wpfnl-create-funnel__inner-content').show(); |
| 48 |
j('#wpfnl-create-steps_inner-content').hide(); |
| 49 |
|
| 50 |
j('.wpfnl-dashboard__header:not(.create-funnel__header)').hide(); |
| 51 |
j('.wpfnl-dashboard__inner-content').hide(); |
| 52 |
j('.wpfnl-funnel-settings__inner-content').hide(); |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* get all step templates |
| 57 |
* |
| 58 |
* @param e |
| 59 |
*/ |
| 60 |
TemplateLibrary.prototype.getStepTemplates = function(e) { |
| 61 |
e.preventDefault(); |
| 62 |
j('#wpfnl-create-funnel__inner-content').hide(); |
| 63 |
j('#wpfnl-create-steps_inner-content').show(); |
| 64 |
j('#template-library-modal').show(); |
| 65 |
|
| 66 |
//---for steps--- |
| 67 |
j('.steps-page__content').addClass('p0'); |
| 68 |
j('.wpfnl-single-step__content').hide(); |
| 69 |
j('.steps-settings').hide(); |
| 70 |
j('div.create-first-step').hide(); |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
/** |
| 75 |
* close template modals |
| 76 |
* |
| 77 |
* @param e |
| 78 |
*/ |
| 79 |
TemplateLibrary.prototype.closeTemplateLibraryModal = function (e) { |
| 80 |
e.preventDefault(); |
| 81 |
j('#template-library-modal').hide(); |
| 82 |
j('#create-funnel-loader').removeClass('show'); |
| 83 |
|
| 84 |
j('.wpfnl-dashboard__header:not(.create-funnel__header)').show(); |
| 85 |
j('.wpfnl-dashboard__inner-content').show(); |
| 86 |
j('.wpfnl-funnel-settings__inner-content').show(); |
| 87 |
|
| 88 |
//---for steps--- |
| 89 |
j('.steps-page__content').removeClass('p0'); |
| 90 |
j('.wpfnl-single-step__content').show(); |
| 91 |
j('.steps-settings').show(); |
| 92 |
j('div.create-first-step').show(); |
| 93 |
} |
| 94 |
new TemplateLibrary(); |
| 95 |
}) |
| 96 |
|