added translate for form name

This commit is contained in:
decoder 2024-03-06 23:11:10 +05:00
parent c18c2d0f32
commit fd9dc5d545
8 changed files with 1809 additions and 1398 deletions

View File

@ -191,7 +191,7 @@ class FormController extends Controller
public function update($id)
{
try {
$input = request()->only('name', 'description', 'slug');
$input = request()->only('name', 'name_ru', 'name_est', 'description', 'slug');
$form_data = [
'form' => request()->input('form'),
'emailConfig' => request()->input('email_config'),
@ -210,6 +210,8 @@ class FormController extends Controller
$form = Form::find($id);
$form->name = $input['name'];
$form->name_ru = $input['name_ru'];
$form->name_est = $input['name_est'];
$form->slug = $input['slug'];
$form->description = $input['description'];
$form->schema = $input['schema'];

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\UserSetting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Session;
@ -17,6 +18,14 @@ class LocaleController extends Controller
app()->setLocale($locale);
$userSetting = UserSetting::where('user_id', auth()->user()->id)->first();
if (!empty($userSetting)) {
$userSetting->update([
'language' => $locale
]);
}
return redirect()->back();
}
}

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\UserSetting;
use DateTimeZone;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
class ManageSettingsController extends Controller
{
@ -57,6 +58,14 @@ class ManageSettingsController extends Controller
$setting = UserSetting::where('user_id', $input['user_id'])->first();
if (! in_array($request->language, ['en', 'ru', 'est'])) {
abort(400);
}
Session::put('locale', $request->language);
app()->setLocale($request->language);
if (empty($setting)) {
UserSetting::create($input);
} else {

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->string('name_ru')->after('name')->nullable();
$table->string('name_est')->after('name_ru')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
//
});
}
};

View File

@ -685,4 +685,6 @@ return [
'placeholder_ru' => 'Placeholder in Ru',
'options_est' => 'Options in est',
'options_ru' => 'Options in Ru',
'form_name_est' => 'Form Name est',
'form_name_ru' => 'Form Name ru',
];

View File

@ -3,114 +3,244 @@
<form id="create_form">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="form-tab" data-toggle="tab" href="#form_builder_tab" role="tab" aria-controls="form" aria-selected="true">
<i class="fas fa-align-justify"></i> {{ trans('messages.form') }}
<a
class="nav-link active"
id="form-tab"
data-toggle="tab"
href="#form_builder_tab"
role="tab"
aria-controls="form"
aria-selected="true"
>
<i class="fas fa-align-justify"></i> {{ trans("messages.form") }}
</a>
</li>
<li class="nav-item" role="presentation" id="tour_step_4">
<a class="nav-link" id="field_conditions-tab" data-toggle="tab" href="#field_conditions_tab" role="tab" aria-controls="field_conditions" aria-selected="false">
<i class="fas fa-wrench"></i> {{trans('messages.field_conditions')}}
<a
class="nav-link"
id="field_conditions-tab"
data-toggle="tab"
href="#field_conditions_tab"
role="tab"
aria-controls="field_conditions"
aria-selected="false"
>
<i class="fas fa-wrench"></i>
{{ trans("messages.field_conditions") }}
</a>
</li>
<li class="nav-item" role="presentation" id="tour_step_5">
<a class="nav-link" id="email-tab" data-toggle="tab" href="#email_settings_tab" role="tab" aria-controls="email" aria-selected="false">
<i class="fas fa-envelope"></i> {{trans('messages.email')}}
<a
class="nav-link"
id="email-tab"
data-toggle="tab"
href="#email_settings_tab"
role="tab"
aria-controls="email"
aria-selected="false"
>
<i class="fas fa-envelope"></i> {{ trans("messages.email") }}
</a>
</li>
<li class="nav-item" role="presentation" id="tour_step_6">
<a class="nav-link" id="form-settings-tab" data-toggle="tab" href="#form_settings_tab" role="tab" aria-controls="form-settings" aria-selected="false">
<i class="fas fa-cogs"></i> {{trans('messages.settings')}}
<a
class="nav-link"
id="form-settings-tab"
data-toggle="tab"
href="#form_settings_tab"
role="tab"
aria-controls="form-settings"
aria-selected="false"
>
<i class="fas fa-cogs"></i> {{ trans("messages.settings") }}
</a>
</li>
<li class="nav-item" role="presentation" id="tour_step_7">
<a class="nav-link" id="mailchimp-tab" data-toggle="tab" href="#mailchimp_tab" role="tab" aria-controls="mailchimp" aria-selected="false">
<i class="fab fa-mailchimp fa-lg"></i> {{trans('messages.mailchimp')}}
<a
class="nav-link"
id="mailchimp-tab"
data-toggle="tab"
href="#mailchimp_tab"
role="tab"
aria-controls="mailchimp"
aria-selected="false"
>
<i class="fab fa-mailchimp fa-lg"></i>
{{ trans("messages.mailchimp") }}
</a>
</li>
<li class="nav-item" role="presentation" id="acelle_mail_tour"
v-if="is_acelle_mail_enabled">
<a class="nav-link" id="acelle-mail-tab" data-toggle="tab" href="#acelle_mail_tab" role="tab">
<li
class="nav-item"
role="presentation"
id="acelle_mail_tour"
v-if="is_acelle_mail_enabled"
>
<a
class="nav-link"
id="acelle-mail-tab"
data-toggle="tab"
href="#acelle_mail_tab"
role="tab"
>
<i class="fas fa-mail-bulk"></i>
{{ acelle_mail_name }}
</a>
</li>
<li class="nav-item" role="presentation" id="webhook_tour">
<a class="nav-link" id="webhook-tab" data-toggle="tab" href="#webhook_tab" role="tab">
<a
class="nav-link"
id="webhook-tab"
data-toggle="tab"
href="#webhook_tab"
role="tab"
>
<i class="far fa-paper-plane"></i>
{{trans('messages.webhook')}}
{{ trans("messages.webhook") }}
</a>
</li>
<li class="nav-item" role="presentation" id="tour_step_8">
<a class="nav-link" id="js-css-tab" data-toggle="tab" href="#custom_js_css_tab" role="tab" aria-controls="js-css" aria-selected="false">
<i class="fas fa-file-code"></i> {{trans('messages.additional_js_css')}}
<a
class="nav-link"
id="js-css-tab"
data-toggle="tab"
href="#custom_js_css_tab"
role="tab"
aria-controls="js-css"
aria-selected="false"
>
<i class="fas fa-file-code"></i>
{{ trans("messages.additional_js_css") }}
</a>
</li>
<li class="nav-item" role="presentation">
<button type="button" class="btn btn-xs bg-gradient-danger app_tour_play_btn" @click="getAppTour">
<button
type="button"
class="btn btn-xs bg-gradient-danger app_tour_play_btn"
@click="getAppTour"
>
<i class="far fa-play-circle"></i>
{{trans('messages.app_tour')}}
{{ trans("messages.app_tour") }}
</button>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="form_builder_tab" role="tabpanel" aria-labelledby="form-tab">
<form-tab :selected_elements="selected_elements" :settings="settings" :form="form" :placeholder_img="placeholderImg" :form_custom_attributes="form_custom_attributes"></form-tab>
<div
class="tab-pane fade show active"
id="form_builder_tab"
role="tabpanel"
aria-labelledby="form-tab"
>
<form-tab
:selected_elements="selected_elements"
:settings="settings"
:form="form"
:placeholder_img="placeholderImg"
:form_custom_attributes="form_custom_attributes"
></form-tab>
</div>
<div class="tab-pane fade" id="field_conditions_tab" role="tabpanel" aria-labelledby="field_conditions-tab">
<div
class="tab-pane fade"
id="field_conditions_tab"
role="tabpanel"
aria-labelledby="field_conditions-tab"
>
<condtionalFields
:conditional-fields="conditional_fields"
:selected-elements="selected_elements"
></condtionalFields>
</div>
<div class="tab-pane fade" id="email_settings_tab" role="tabpanel" aria-labelledby="email-tab">
<div
class="tab-pane fade"
id="email_settings_tab"
role="tabpanel"
aria-labelledby="email-tab"
>
<email-tab
:emailConfig="emailConfig"
:selected_elements="selected_elements"
:settings="settings">
:settings="settings"
>
</email-tab>
</div>
<div class="tab-pane fade" id="form_settings_tab" role="tabpanel" aria-labelledby="form-settings-tab">
<div
class="tab-pane fade"
id="form_settings_tab"
role="tabpanel"
aria-labelledby="form-settings-tab"
>
<settings-tab
:settings="settings"
:selected_elements="selected_elements">
:selected_elements="selected_elements"
>
</settings-tab>
</div>
<div class="tab-pane fade" id="mailchimp_tab" role="tabpanel" aria-labelledby="mailchimp-tab">
<div
class="tab-pane fade"
id="mailchimp_tab"
role="tabpanel"
aria-labelledby="mailchimp-tab"
>
<mailchimp
:details="mailchimp_details"
:selected_elements="selected_elements">
:selected_elements="selected_elements"
>
</mailchimp>
</div>
<div class="tab-pane fade" id="acelle_mail_tab" role="tabpanel" aria-labelledby="acelle-mail-tab"
v-if="is_acelle_mail_enabled">
<div
class="tab-pane fade"
id="acelle_mail_tab"
role="tabpanel"
aria-labelledby="acelle-mail-tab"
v-if="is_acelle_mail_enabled"
>
<acelle-mail
:acelle-mail="acelle_mail_info"
:selected_elements="selected_elements">
:selected_elements="selected_elements"
>
</acelle-mail>
</div>
<div class="tab-pane fade" id="webhook_tab" role="tabpanel" aria-labelledby="webhook-tab">
<webhook
:webhook-info="webhook_info"/>
<div
class="tab-pane fade"
id="webhook_tab"
role="tabpanel"
aria-labelledby="webhook-tab"
>
<webhook :webhook-info="webhook_info" />
</div>
<div class="tab-pane fade" id="custom_js_css_tab" role="tabpanel" aria-labelledby="js-css-tab">
<div
class="tab-pane fade"
id="custom_js_css_tab"
role="tabpanel"
aria-labelledby="js-css-tab"
>
<additional-js-css :additional-data="additionalData">
</additional-js-css>
</div>
</div>
<!-- submit button -->
<div v-if="selected_elements.length">
<hr class="mt-5">
<hr class="mt-5" />
<div id="tour_step_9">
<button type="submit" class="btn btn-success btn-lg float-right ladda-form-save-btn mb-2" name="submit_type" value="0">
{{trans('messages.save_as_form')}}
<button
type="submit"
class="btn btn-success btn-lg float-right ladda-form-save-btn mb-2"
name="submit_type"
value="0"
>
{{ trans("messages.save_as_form") }}
</button>
<button type="submit" class="btn btn-secondary btn-lg float-right ladda-template-save-btn mb-2 mr-1" name="submit_type" value="1" v-if="disabled_save_temp_btn">
{{trans('messages.save_as_template')}}
<button
type="submit"
class="btn btn-secondary btn-lg float-right ladda-template-save-btn mb-2 mr-1"
name="submit_type"
value="1"
v-if="disabled_save_temp_btn"
>
{{ trans("messages.save_as_template") }}
</button>
</div>
</div>
<AskUserChoice id="userChoiceModal">
</AskUserChoice>
<AskUserChoice id="userChoiceModal"> </AskUserChoice>
</form>
</div>
</template>
@ -126,7 +256,7 @@
import AcelleMail from "./AcelleMail";
import Webhook from "./Webhook/Webhook";
export default {
props: ['formData', 'placeholderImg', 'saveTemplate'],
props: ["formData", "placeholderImg", "saveTemplate"],
components: {
formTab,
emailTab,
@ -136,7 +266,7 @@
condtionalFields,
AskUserChoice,
AcelleMail,
Webhook
Webhook,
},
data() {
return {
@ -145,38 +275,38 @@
form: [],
emailConfig: {},
settings: {},
dashboard:'',
dashboard: "",
additionalData: {},
mailchimp_details: {},
conditional_fields: [],
form_scheduling: {
closed_msg:'The form has been closed now!',
start_date_time:'',
end_date_time:'',
is_enabled: false
closed_msg: "The form has been closed now!",
start_date_time: "",
end_date_time: "",
is_enabled: false,
},
form_submision_ref: {
is_enabled: false,
prefix: '',
suffix: '',
start_no: '1',
min_digit: '4'
prefix: "",
suffix: "",
start_no: "1",
min_digit: "4",
},
form_theme: 'default',
form_theme: "default",
responseData: [],
is_enabled_draft_submit: 0,
form_custom_attributes: [],
disabled_save_temp_btn: null,
password_protection: {
is_enabled: false,
password: ''
password: "",
},
pdf_design: {
header: `<h1 style="margin-top: 0px; margin-bottom: 0.5rem; font-family: &quot;Source Sans Pro&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.2; color: rgb(0, 0, 0); font-size: 2.5rem; text-align: center;"><span style="color: rgb(33, 37, 41); font-size: 12.8px; text-align: left; background-color: rgb(244, 246, 249);"><span style="font-size: 24px;"><span style="font-weight: bolder;">{form_name}</span></span><sub style="font-size: 9.6px;"><span style="font-size: 12px;">{submission_date}</span></sub></span></h1>`
header: `<h1 style="margin-top: 0px; margin-bottom: 0.5rem; font-family: &quot;Source Sans Pro&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.2; color: rgb(0, 0, 0); font-size: 2.5rem; text-align: center;"><span style="color: rgb(33, 37, 41); font-size: 12.8px; text-align: left; background-color: rgb(244, 246, 249);"><span style="font-size: 24px;"><span style="font-weight: bolder;">{form_name}</span></span><sub style="font-size: 9.6px;"><span style="font-size: 12px;">{submission_date}</span></sub></span></h1>`,
},
spread_to_col: {
enable: false,
column: 2
column: 2,
},
acelle_mail_info: {},
is_acelle_mail_enabled: APP.ACELLE_MAIL_ENABLED,
@ -184,40 +314,57 @@
webhook_info: {},
popover_help_text: {
enable: false,
content: ''
}
content: "",
},
};
},
created() {
this.form_parsed = JSON.parse(this.formData);
this.form.name = this.form_parsed.name;
this.form.name_ru = this.form_parsed.name_ru;
this.form.name_est = this.form_parsed.name_est;
this.form.slug = this.form_parsed.slug;
this.form.description = this.form_parsed.description;
this.form.is_template = this.form_parsed.is_template;
this.disabled_save_temp_btn = JSON.parse(this.saveTemplate);
if (this.form_parsed.schema === null) {
this.emailConfig = this.getData('email_config');
this.settings = this.getData('settings');
this.additionalData = {js:'', css:''};
this.conditional_fields = this.getData('conditional_fields');
this.emailConfig = this.getData("email_config");
this.settings = this.getData("settings");
this.additionalData = { js: "", css: "" };
this.conditional_fields = this.getData("conditional_fields");
} else {
this.selected_elements = this.form_parsed.schema.form;
this.emailConfig = this.form_parsed.schema.emailConfig;
this.settings = this.form_parsed.schema.settings;
this.additionalData = _.isNull(this.form_parsed.schema.additional_js_css) ? {js:'', css:''} : this.form_parsed.schema.additional_js_css;
this.additionalData = _.isNull(this.form_parsed.schema.additional_js_css)
? { js: "", css: "" }
: this.form_parsed.schema.additional_js_css;
this.mailchimp_details = _.isNull(this.form_parsed.mailchimp_details) ? this.getData('mailchimp') : this.form_parsed.mailchimp_details;
this.mailchimp_details = _.isNull(this.form_parsed.mailchimp_details)
? this.getData("mailchimp")
: this.form_parsed.mailchimp_details;
this.acelle_mail_info = _.isEmpty(this.form_parsed.acelle_mail_info) ? this.getData('acelle_mail') : this.form_parsed.acelle_mail_info;
this.acelle_mail_info = _.isEmpty(this.form_parsed.acelle_mail_info)
? this.getData("acelle_mail")
: this.form_parsed.acelle_mail_info;
this.conditional_fields = _.isUndefined(this.form_parsed.schema.conditional_fields) ? this.getData('conditional_fields') : this.form_parsed.schema.conditional_fields;
this.form_custom_attributes = _.isUndefined(this.form_parsed.schema.form_attributes) ? this.form_custom_attributes : this.form_parsed.schema.form_attributes;
this.conditional_fields = _.isUndefined(
this.form_parsed.schema.conditional_fields
)
? this.getData("conditional_fields")
: this.form_parsed.schema.conditional_fields;
this.form_custom_attributes = _.isUndefined(
this.form_parsed.schema.form_attributes
)
? this.form_custom_attributes
: this.form_parsed.schema.form_attributes;
}
this.webhook_info = this.form_parsed?.webhook_info || this.getData('webhook_info');
this.webhook_info =
this.form_parsed?.webhook_info || this.getData("webhook_info");
this.getNewlyAddedPropertyForExistingForm();
this.$eventBus.$on('callRedirectUser', (data) => {
this.$eventBus.$on("callRedirectUser", (data) => {
$("#userChoiceModal").modal("hide");
setTimeout(() => {
this.redirectUsersAccordingToResponse(data);
@ -225,12 +372,12 @@
});
},
beforeDestroy() {
this.$eventBus.$off('callRedirectUser');
this.$eventBus.$off("callRedirectUser");
},
mounted() {
const self = this;
$('form#create_form').validate({
$("form#create_form").validate({
ignore: ".note-editor *",
submitHandler: function (form, e) {
var field_names = [];
@ -238,28 +385,45 @@
for (let index = 0; index < self.selected_elements.length; index++) {
self.selected_elements[index].extras.showConfigurator = false;
if (_.isEmpty(self.selected_elements[index].name)) {
toastr.error(self.trans('messages.field_dont_have_name_property', {
toastr.error(
self.trans("messages.field_dont_have_name_property", {
input: self.selected_elements[index].label,
}));
})
);
return false;
} else if (/\s/.test(self.selected_elements[index].name)) {
toastr.error(self.trans('messages.field_contain_space', {
toastr.error(
self.trans("messages.field_contain_space", {
input: self.selected_elements[index].label,
}));
})
);
return false;
} else if (_.includes(field_names, self.selected_elements[index].name)) {
toastr.error(self.trans('messages.field_contain_duplicate_field_name', {
} else if (
_.includes(field_names, self.selected_elements[index].name)
) {
toastr.error(
self.trans("messages.field_contain_duplicate_field_name", {
input: self.selected_elements[index].label,
}));
})
);
field_names = [];
return false;
}else if (!_.includes(field_names, self.selected_elements[index].name)) {
} else if (
!_.includes(field_names, self.selected_elements[index].name)
) {
field_names.push(self.selected_elements[index].name);
}
}
}
let data = _.pick(self.form, ['name', 'description', 'slug']);
let data = _.pick(self.form, [
"name",
"name_ru",
"name_est",
"description",
"slug",
]);
console.log(data);
data.form = self.selected_elements;
data.email_config = self.emailConfig;
data.settings = self.settings;
@ -269,26 +433,36 @@
data.conditional_fields = self.conditional_fields;
data.is_template = $("input[name='submit_type']").val();
data.form_attributes = self.form_custom_attributes;
data.contains_page_break = _.some(self.selected_elements, {type: "page_break"});
data.contains_page_break = _.some(self.selected_elements, {
type: "page_break",
});
data.webhook_info = self.webhook_info;
//get ladda btn based on submit type
if (data.is_template === '1') {
var ladda = Ladda.create(document.querySelector('.ladda-template-save-btn'));
if (data.is_template === "1") {
var ladda = Ladda.create(
document.querySelector(".ladda-template-save-btn")
);
} else {
var ladda = Ladda.create(document.querySelector('.ladda-form-save-btn'));
var ladda = Ladda.create(
document.querySelector(".ladda-form-save-btn")
);
}
if ($('form#create_form').valid()) {
if ($("form#create_form").valid()) {
//disable both btn and start ladda
$("button.ladda-form-save-btn, button.ladda-template-save-btn").attr('disabled', 'disabled');
$("button.ladda-form-save-btn, button.ladda-template-save-btn").attr(
"disabled",
"disabled"
);
ladda.start();
axios
.put('/forms/'+self.form_parsed.id, data)
.put("/forms/" + self.form_parsed.id, data)
.then(function (response) {
//remove disable from both btn and stop ladda
$("button.ladda-form-save-btn, button.ladda-template-save-btn").removeAttr("disabled");
$(
"button.ladda-form-save-btn, button.ladda-template-save-btn"
).removeAttr("disabled");
ladda.stop();
if (response.data.success == true) {
@ -302,146 +476,143 @@
console.log(error);
});
}
}
},
});
//if mpfg_tour not finished call getAppTour
if (_.isNull(localStorage.getItem("mpfg_tour"))) {
localStorage.setItem("mpfg_tour", 'finished');
localStorage.setItem("mpfg_tour", "finished");
this.getAppTour();
}
},
methods: {
getData(type) {
if (type == 'email_config') {
if (type == "email_config") {
var email = {
email: {
enable: '',
from: '',
to: '',
reply_to_email: '',
cc:'',
bcc:'',
subject: '',
body:'',
attach_pdf: false
enable: "",
from: "",
to: "",
reply_to_email: "",
cc: "",
bcc: "",
subject: "",
body: "",
attach_pdf: false,
},
auto_response: {
from:'',
to:'',
subject: '',
body: '',
from: "",
to: "",
subject: "",
body: "",
is_enable: false,
attach_pdf: false
attach_pdf: false,
},
smtp: {
host:'',
port:'',
from_address:'',
from_name:'',
encryption:'',
username:'',
password:'',
use_system_smtp:1
}
host: "",
port: "",
from_address: "",
from_name: "",
encryption: "",
username: "",
password: "",
use_system_smtp: 1,
},
};
return email;
} else if (type == 'settings') {
} else if (type == "settings") {
var setting = {
recaptcha: {
is_enable: 0,
site_key:'',
secret_key:''
site_key: "",
secret_key: "",
},
color: {
label:'#000000',
error_msg:'#a94442',
required_asterisk_color:'#a94442',
background:'#ffffff',
image_path:'',
page_color:'#f4f6f9'
label: "#000000",
error_msg: "#a94442",
required_asterisk_color: "#a94442",
background: "#ffffff",
image_path: "",
page_color: "#f4f6f9",
},
notification: {
post_submit_action:'same_page',
failed_msg:'Something went wrong, please try again.',
success_msg:'Your submission has been received.',
redirect_url:'',
position: 'toast-top-right'
post_submit_action: "same_page",
failed_msg: "Something went wrong, please try again.",
success_msg: "Your submission has been received.",
redirect_url: "",
position: "toast-top-right",
},
submit: {
text:'Submit',
loading_text:'Submitting...',
btn_alignment:'float-right',
btn_size:'',
btn_color:'btn-primary',
btn_style: 'default',
btn_icon: 'none',
icon_position:'left'
text: "Submit",
loading_text: "Submitting...",
btn_alignment: "float-right",
btn_size: "",
btn_color: "btn-primary",
btn_style: "default",
btn_icon: "none",
icon_position: "left",
},
form_data: {
col_visible: [],
btn_enabled:[
'view', 'delete'
]
btn_enabled: ["view", "delete"],
},
background: {
bg_type:'bg_color'
bg_type: "bg_color",
},
form_scheduling: this.form_scheduling,
form_submision_ref: this.form_submision_ref,
theme: this.form_theme,
is_enabled_draft_submit: this.is_enabled_draft_submit,
layout: 'classic',
layout: "classic",
password_protection: this.password_protection,
pdf_design: this.pdf_design,
is_qr_code_enabled: false,
qr_code_data_format: 'string',
qr_code_data_format: "string",
is_ref_num_bar_code_enabled: false,
is_ref_num_qr_code_enabled: false
is_ref_num_qr_code_enabled: false,
};
return setting;
} else if(type == 'mailchimp'){
} else if (type == "mailchimp") {
return {
is_enable: false,
api_key: '',
list_id: '',
email_field: '',
name_field: ''
api_key: "",
list_id: "",
email_field: "",
name_field: "",
};
} else if(type == 'acelle_mail'){
} else if (type == "acelle_mail") {
return {
is_enable: false,
api_token: '',
list_id: '',
campaign_fields: []
api_token: "",
list_id: "",
campaign_fields: [],
};
} else if (type == 'conditional_fields') {
} else if (type == "conditional_fields") {
var conditional_fields = [
{
'action':'',
'element':'',
'conditions': [
action: "",
element: "",
conditions: [
{
'condition':'',
'value':"",
'element_type' : 'text',
'element_index' : '',
'operator' : '==',
'logical_operator' : 'AND'
}
]
}
condition: "",
value: "",
element_type: "text",
element_index: "",
operator: "==",
logical_operator: "AND",
},
],
},
];
return conditional_fields;
} else if (type == 'webhook_info') {
} else if (type == "webhook_info") {
return {
is_enable: false,
url: '',
secret_key: ''
url: "",
secret_key: "",
};
}
},
@ -449,32 +620,32 @@
const self = this;
_.forEach(self.selected_elements, function (element) {
if (_.isUndefined(element.conditional_class)) {
element.conditional_class = '';
element.conditional_class = "";
}
if (_.isUndefined(element.col)) {
element.col = 'col-md-12';
element.col = "col-md-12";
}
if (_.isUndefined(element.popover_help_text)) {
element['popover_help_text'] = _.clone(self.popover_help_text);
element["popover_help_text"] = _.clone(self.popover_help_text);
}
//if spread to col option is undefined for element set to default
if (
_.includes(['radio', 'checkbox'], element.type) &&
_.includes(["radio", "checkbox"], element.type) &&
_.isUndefined(element.spread_to_col)
) {
element.spread_to_col = self.spread_to_col;
}
if (
_.includes(['text'], element.type) &&
_.includes(['text', 'email', 'number'], element.subtype) &&
_.includes(["text"], element.type) &&
_.includes(["text", "email", "number"], element.subtype) &&
_.isUndefined(element.allowed_input)
) {
element.allowed_input = {
values:'',
error_msg: 'This value is not allowed.'
values: "",
error_msg: "This value is not allowed.",
};
}
});
@ -492,19 +663,19 @@
}
if (_.isUndefined(self.settings.is_qr_code_enabled)) {
Vue.set(self.settings, 'is_qr_code_enabled', false);
Vue.set(self.settings, "is_qr_code_enabled", false);
}
if (
_.isUndefined(self.settings.is_ref_num_bar_code_enabled) ||
_.isUndefined(self.settings.is_ref_num_qr_code_enabled)
) {
Vue.set(self.settings, 'is_ref_num_bar_code_enabled', false);
Vue.set(self.settings, 'is_ref_num_qr_code_enabled', false);
Vue.set(self.settings, "is_ref_num_bar_code_enabled", false);
Vue.set(self.settings, "is_ref_num_qr_code_enabled", false);
}
if (_.isUndefined(self.settings.qr_code_data_format)) {
Vue.set(self.settings, 'qr_code_data_format', 'string');
Vue.set(self.settings, "qr_code_data_format", "string");
}
if (_.isUndefined(self.settings.is_enabled_draft_submit)) {
@ -512,23 +683,23 @@
}
if (_.isUndefined(self.settings.notification.position)) {
self.settings.notification.position = 'toast-top-right';
self.settings.notification.position = "toast-top-right";
}
if (_.isUndefined(self.settings.submit.btn_style)) {
Vue.set(self.settings.submit, 'btn_style', 'default');
Vue.set(self.settings.submit, "btn_style", "default");
}
if (_.isUndefined(self.settings.submit.btn_icon)) {
Vue.set(self.settings.submit, 'btn_icon', 'none');
Vue.set(self.settings.submit, "btn_icon", "none");
}
if (_.isUndefined(self.settings.submit.icon_position)) {
Vue.set(self.settings.submit, 'icon_position', 'left');
Vue.set(self.settings.submit, "icon_position", "left");
}
if (_.isUndefined(self.settings.color.page_color)) {
Vue.set(self.settings.color, 'page_color', '#f4f6f9');
Vue.set(self.settings.color, "page_color", "#f4f6f9");
}
if (_.isUndefined(self.settings.password_protection)) {
@ -540,16 +711,15 @@
}
},
redirectUsersAccordingToResponse(choice) {
if (choice == 'home') {
if (choice == "home") {
window.location = this.responseData.redirect;
} else if (choice == 'preview') {
} else if (choice == "preview") {
window.open(this.responseData.preview, this.responseData.form_name);
}
},
getAppTour() {
if (!$('#appTab a[href="#form-generator"]').hasClass('active')) {
$('#appTab a[href="#form-generator"]').tab('show');
if (!$('#appTab a[href="#form-generator"]').hasClass("active")) {
$('#appTab a[href="#form-generator"]').tab("show");
}
const self = this;
@ -557,61 +727,61 @@
intro.setOptions({
steps: [
{
intro : self.trans('messages.welcome_tour_msg')
intro: self.trans("messages.welcome_tour_msg"),
},
{
element: document.querySelectorAll('#tour_step_1')[0],
intro: self.trans('messages.tour_step_1_intro'),
position: 'right',
scrollTo: 'tooltip'
element: document.querySelectorAll("#tour_step_1")[0],
intro: self.trans("messages.tour_step_1_intro"),
position: "right",
scrollTo: "tooltip",
},
{
element: '#tour_step_2',
intro: self.trans('messages.tour_step_2_intro'),
position: 'right',
scrollTo: 'tooltip'
element: "#tour_step_2",
intro: self.trans("messages.tour_step_2_intro"),
position: "right",
scrollTo: "tooltip",
},
{
element: '#tour_step_3',
intro: self.trans('messages.tour_step_3_intro'),
position: 'bottom',
scrollTo: 'tooltip'
element: "#tour_step_3",
intro: self.trans("messages.tour_step_3_intro"),
position: "bottom",
scrollTo: "tooltip",
},
{
element: '#tour_step_4',
intro: self.trans('messages.tour_step_4_intro'),
scrollTo: 'tooltip'
element: "#tour_step_4",
intro: self.trans("messages.tour_step_4_intro"),
scrollTo: "tooltip",
},
{
element: '#tour_step_5',
intro: self.trans('messages.tour_step_5_intro'),
scrollTo: 'tooltip'
element: "#tour_step_5",
intro: self.trans("messages.tour_step_5_intro"),
scrollTo: "tooltip",
},
{
element: '#tour_step_6',
intro: self.trans('messages.tour_step_6_intro'),
scrollTo: 'tooltip'
element: "#tour_step_6",
intro: self.trans("messages.tour_step_6_intro"),
scrollTo: "tooltip",
},
{
element: '#tour_step_7',
intro: self.trans('messages.tour_step_7_intro'),
scrollTo: 'tooltip'
element: "#tour_step_7",
intro: self.trans("messages.tour_step_7_intro"),
scrollTo: "tooltip",
},
{
element: '#tour_step_8',
intro: self.trans('messages.tour_step_8_intro'),
scrollTo: 'tooltip'
element: "#tour_step_8",
intro: self.trans("messages.tour_step_8_intro"),
scrollTo: "tooltip",
},
{
element: '#tour_step_9',
intro: self.trans('messages.tour_step_9_intro'),
scrollTo: 'tooltip'
}
]
element: "#tour_step_9",
intro: self.trans("messages.tour_step_9_intro"),
scrollTo: "tooltip",
},
],
});
intro.start();
}
}
}
},
},
};
</script>

File diff suppressed because it is too large Load Diff

View File

@ -178,6 +178,15 @@
@section('footer')
<script type="text/javascript">
$(document).ready(function () {
var lang = `{{session()->get('locale')}}`
var titleColName = 'name';
console.log(lang);
if (lang === 'est') {
titleColName = 'name_est'
} else if (lang === 'ru') {
titleColName = 'name_ru'
}
// form dataTable
var form_table = $('#form_table').DataTable({
@ -196,7 +205,15 @@
{"width": "20%", "targets": 4}
],
columns: [
{data: 'name', name: 'name'},
{
data: titleColName,
name: titleColName,
createdCell: function (td, cellData, rowData, row, col) {
if (td.innerHTML.length === 0) {
td.innerHTML = rowData.name
}
},
},
{data: 'description', name: 'description'},
{data: 'created_at', name: 'created_at'},
{data: 'data_count', name: 'data_count', searchable: false},