change table struct
This commit is contained in:
		
							parent
							
								
									4cb505276f
								
							
						
					
					
						commit
						cf7c57228a
					
				@ -191,7 +191,7 @@ class FormController extends Controller
 | 
			
		||||
    public function update($id)
 | 
			
		||||
    {
 | 
			
		||||
        try {
 | 
			
		||||
            $input = request()->only('name', 'name_ru', 'name_est', 'description', 'slug');
 | 
			
		||||
            $input = request()->only('name', 'name_ru', 'name_est', 'description', 'description_ru', 'description_est', 'slug');
 | 
			
		||||
            $form_data = [
 | 
			
		||||
                'form' => request()->input('form'),
 | 
			
		||||
                'emailConfig' => request()->input('email_config'),
 | 
			
		||||
@ -214,6 +214,8 @@ class FormController extends Controller
 | 
			
		||||
            $form->name_est = $input['name_est'];
 | 
			
		||||
            $form->slug = $input['slug'];
 | 
			
		||||
            $form->description = $input['description'];
 | 
			
		||||
            $form->description_ru = $input['description_ru'];
 | 
			
		||||
            $form->description_est = $input['description_est'];
 | 
			
		||||
            $form->schema = $input['schema'];
 | 
			
		||||
            $form->is_template = $is_template;
 | 
			
		||||
            $form->mailchimp_details = request()->input('mailchimp_details');
 | 
			
		||||
 | 
			
		||||
@ -183,7 +183,7 @@ class HomeController extends Controller
 | 
			
		||||
        if (request()->ajax()) {
 | 
			
		||||
            $user_id = request()->user()->id;
 | 
			
		||||
 | 
			
		||||
            $forms = Form::select('name', 'description', 'id', 'slug', 'is_global_template')
 | 
			
		||||
            $forms = Form::select('name', 'name_est', 'name_ru', 'description', 'description_ru', 'description_est', 'id', 'slug', 'is_global_template')
 | 
			
		||||
                ->where(function ($query) use ($user_id) {
 | 
			
		||||
                    $query->where('is_template', 1)
 | 
			
		||||
                        ->where('created_by', $user_id)
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,8 @@ return new class extends Migration
 | 
			
		||||
        Schema::table('forms', function (Blueprint $table) {
 | 
			
		||||
            $table->string('name_ru')->after('name')->nullable();
 | 
			
		||||
            $table->string('name_est')->after('name_ru')->nullable();
 | 
			
		||||
            $table->string('description_ru')->after('description')->nullable();
 | 
			
		||||
            $table->string('description_est')->after('description_ru')->nullable();
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -687,4 +687,6 @@ return [
 | 
			
		||||
    'options_ru' => 'Options in Ru',
 | 
			
		||||
    'form_name_est' => 'Form Name est',
 | 
			
		||||
    'form_name_ru' => 'Form Name ru',
 | 
			
		||||
    'form_description_est' => 'Form Description est',
 | 
			
		||||
    'form_description_ru' => 'Form Description ru',
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,8 @@
 | 
			
		||||
                        aria-controls="form"
 | 
			
		||||
                        aria-selected="true"
 | 
			
		||||
                    >
 | 
			
		||||
            <i class="fas fa-align-justify"></i> {{ trans("messages.form") }}
 | 
			
		||||
                        <i class="fas fa-align-justify"></i>
 | 
			
		||||
                        {{ trans("messages.form") }}
 | 
			
		||||
                    </a>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li class="nav-item" role="presentation" id="tour_step_4">
 | 
			
		||||
@ -39,7 +40,8 @@
 | 
			
		||||
                        aria-controls="email"
 | 
			
		||||
                        aria-selected="false"
 | 
			
		||||
                    >
 | 
			
		||||
            <i class="fas fa-envelope"></i> {{ trans("messages.email") }}
 | 
			
		||||
                        <i class="fas fa-envelope"></i>
 | 
			
		||||
                        {{ trans("messages.email") }}
 | 
			
		||||
                    </a>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li class="nav-item" role="presentation" id="tour_step_6">
 | 
			
		||||
@ -52,7 +54,8 @@
 | 
			
		||||
                        aria-controls="form-settings"
 | 
			
		||||
                        aria-selected="false"
 | 
			
		||||
                    >
 | 
			
		||||
            <i class="fas fa-cogs"></i> {{ trans("messages.settings") }}
 | 
			
		||||
                        <i class="fas fa-cogs"></i>
 | 
			
		||||
                        {{ trans("messages.settings") }}
 | 
			
		||||
                    </a>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li class="nav-item" role="presentation" id="tour_step_7">
 | 
			
		||||
@ -325,6 +328,8 @@ export default {
 | 
			
		||||
        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.description_ru = this.form_parsed.description_ru;
 | 
			
		||||
        this.form.description_est = this.form_parsed.description_est;
 | 
			
		||||
        this.form.is_template = this.form_parsed.is_template;
 | 
			
		||||
        this.disabled_save_temp_btn = JSON.parse(this.saveTemplate);
 | 
			
		||||
        if (this.form_parsed.schema === null) {
 | 
			
		||||
@ -336,11 +341,15 @@ export default {
 | 
			
		||||
            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)
 | 
			
		||||
            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.mailchimp_details = _.isNull(
 | 
			
		||||
                this.form_parsed.mailchimp_details
 | 
			
		||||
            )
 | 
			
		||||
                ? this.getData("mailchimp")
 | 
			
		||||
                : this.form_parsed.mailchimp_details;
 | 
			
		||||
 | 
			
		||||
@ -382,16 +391,28 @@ export default {
 | 
			
		||||
            submitHandler: function (form, e) {
 | 
			
		||||
                var field_names = [];
 | 
			
		||||
                if (self.selected_elements.length > 0) {
 | 
			
		||||
          for (let index = 0; index < self.selected_elements.length; index++) {
 | 
			
		||||
            self.selected_elements[index].extras.showConfigurator = false;
 | 
			
		||||
                    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", {
 | 
			
		||||
                  input: self.selected_elements[index].label,
 | 
			
		||||
                })
 | 
			
		||||
                                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)) {
 | 
			
		||||
                        } else if (
 | 
			
		||||
                            /\s/.test(self.selected_elements[index].name)
 | 
			
		||||
                        ) {
 | 
			
		||||
                            toastr.error(
 | 
			
		||||
                                self.trans("messages.field_contain_space", {
 | 
			
		||||
                                    input: self.selected_elements[index].label,
 | 
			
		||||
@ -399,19 +420,31 @@ export default {
 | 
			
		||||
                            );
 | 
			
		||||
                            return false;
 | 
			
		||||
                        } else if (
 | 
			
		||||
              _.includes(field_names, self.selected_elements[index].name)
 | 
			
		||||
                            _.includes(
 | 
			
		||||
                                field_names,
 | 
			
		||||
                                self.selected_elements[index].name
 | 
			
		||||
                            )
 | 
			
		||||
                        ) {
 | 
			
		||||
                            toastr.error(
 | 
			
		||||
                self.trans("messages.field_contain_duplicate_field_name", {
 | 
			
		||||
                  input: self.selected_elements[index].label,
 | 
			
		||||
                })
 | 
			
		||||
                                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)
 | 
			
		||||
                            !_.includes(
 | 
			
		||||
                                field_names,
 | 
			
		||||
                                self.selected_elements[index].name
 | 
			
		||||
                            )
 | 
			
		||||
                        ) {
 | 
			
		||||
              field_names.push(self.selected_elements[index].name);
 | 
			
		||||
                            field_names.push(
 | 
			
		||||
                                self.selected_elements[index].name
 | 
			
		||||
                            );
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
@ -421,6 +454,8 @@ export default {
 | 
			
		||||
                    "name_ru",
 | 
			
		||||
                    "name_est",
 | 
			
		||||
                    "description",
 | 
			
		||||
                    "description_ru",
 | 
			
		||||
                    "description_est",
 | 
			
		||||
                    "slug",
 | 
			
		||||
                ]);
 | 
			
		||||
                console.log(data);
 | 
			
		||||
@ -450,10 +485,9 @@ export default {
 | 
			
		||||
 | 
			
		||||
                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
 | 
			
		||||
@ -628,7 +662,9 @@ export default {
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                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 (
 | 
			
		||||
@ -679,7 +715,8 @@ export default {
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (_.isUndefined(self.settings.is_enabled_draft_submit)) {
 | 
			
		||||
        self.settings.is_enabled_draft_submit = self.is_enabled_draft_submit;
 | 
			
		||||
                self.settings.is_enabled_draft_submit =
 | 
			
		||||
                    self.is_enabled_draft_submit;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (_.isUndefined(self.settings.notification.position)) {
 | 
			
		||||
@ -714,7 +751,10 @@ export default {
 | 
			
		||||
            if (choice == "home") {
 | 
			
		||||
                window.location = this.responseData.redirect;
 | 
			
		||||
            } else if (choice == "preview") {
 | 
			
		||||
        window.open(this.responseData.preview, this.responseData.form_name);
 | 
			
		||||
                window.open(
 | 
			
		||||
                    this.responseData.preview,
 | 
			
		||||
                    this.responseData.form_name
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        getAppTour() {
 | 
			
		||||
 | 
			
		||||
@ -4,15 +4,23 @@
 | 
			
		||||
            <div class="element-sidebar">
 | 
			
		||||
                <div class="card">
 | 
			
		||||
                    <div class="card-header">
 | 
			
		||||
            <p class="card-title">{{ trans("messages.elements") }}</p>
 | 
			
		||||
                        <p class="card-title">
 | 
			
		||||
                            {{ trans("messages.elements") }}
 | 
			
		||||
                        </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <div class="collapse show" id="basicElements">
 | 
			
		||||
            <div class="card-body pr-1 pl-1 elements_sidebar_height">
 | 
			
		||||
                        <div
 | 
			
		||||
                            class="card-body pr-1 pl-1 elements_sidebar_height"
 | 
			
		||||
                        >
 | 
			
		||||
                            <draggable
 | 
			
		||||
                                class="dragArea list-group"
 | 
			
		||||
                                :list="basic_elements"
 | 
			
		||||
                :group="{ name: 'element', pull: 'clone', put: false }"
 | 
			
		||||
                                :group="{
 | 
			
		||||
                                    name: 'element',
 | 
			
		||||
                                    pull: 'clone',
 | 
			
		||||
                                    put: false,
 | 
			
		||||
                                }"
 | 
			
		||||
                                :clone="cloneElement"
 | 
			
		||||
                                :sort="false"
 | 
			
		||||
                                @change="change"
 | 
			
		||||
@ -26,30 +34,55 @@
 | 
			
		||||
                                        type="button"
 | 
			
		||||
                                        class="btn btn-primary btn-block"
 | 
			
		||||
                                        :class="[
 | 
			
		||||
                      _.includes(['card_form'], settings.layout) &&
 | 
			
		||||
                      _.includes(['page_break'], element.type)
 | 
			
		||||
                                            _.includes(
 | 
			
		||||
                                                ['card_form'],
 | 
			
		||||
                                                settings.layout
 | 
			
		||||
                                            ) &&
 | 
			
		||||
                                            _.includes(
 | 
			
		||||
                                                ['page_break'],
 | 
			
		||||
                                                element.type
 | 
			
		||||
                                            )
 | 
			
		||||
                                                ? ''
 | 
			
		||||
                                                : 'hvr-grow',
 | 
			
		||||
                                        ]"
 | 
			
		||||
                                        :title="element.tooltip"
 | 
			
		||||
                                        :disabled="
 | 
			
		||||
                      _.includes(['card_form'], settings.layout) &&
 | 
			
		||||
                      _.includes(['page_break'], element.type)
 | 
			
		||||
                                            _.includes(
 | 
			
		||||
                                                ['card_form'],
 | 
			
		||||
                                                settings.layout
 | 
			
		||||
                                            ) &&
 | 
			
		||||
                                            _.includes(
 | 
			
		||||
                                                ['page_break'],
 | 
			
		||||
                                                element.type
 | 
			
		||||
                                            )
 | 
			
		||||
                                        "
 | 
			
		||||
                                    >
 | 
			
		||||
                                        <i
 | 
			
		||||
                                            class="mt-1 mb-1"
 | 
			
		||||
                      :class="'float-left fas fa-' + element.display_icon"
 | 
			
		||||
                                            :class="
 | 
			
		||||
                                                'float-left fas fa-' +
 | 
			
		||||
                                                element.display_icon
 | 
			
		||||
                                            "
 | 
			
		||||
                                        ></i>
 | 
			
		||||
                                        {{ element.label }}
 | 
			
		||||
                                        <i
 | 
			
		||||
                                            v-if="
 | 
			
		||||
                        _.includes(['card_form'], settings.layout) &&
 | 
			
		||||
                        _.includes(['page_break'], element.type)
 | 
			
		||||
                                                _.includes(
 | 
			
		||||
                                                    ['card_form'],
 | 
			
		||||
                                                    settings.layout
 | 
			
		||||
                                                ) &&
 | 
			
		||||
                                                _.includes(
 | 
			
		||||
                                                    ['page_break'],
 | 
			
		||||
                                                    element.type
 | 
			
		||||
                                                )
 | 
			
		||||
                                            "
 | 
			
		||||
                                            class="fas fa-info-circle float-right mt-1 mb-1"
 | 
			
		||||
                                            data-toggle="tooltip"
 | 
			
		||||
                      :title="trans('messages.page_break_disabled')"
 | 
			
		||||
                                            :title="
 | 
			
		||||
                                                trans(
 | 
			
		||||
                                                    'messages.page_break_disabled'
 | 
			
		||||
                                                )
 | 
			
		||||
                                            "
 | 
			
		||||
                                        ></i>
 | 
			
		||||
                                    </button>
 | 
			
		||||
                                </div>
 | 
			
		||||
@ -76,7 +109,10 @@
 | 
			
		||||
                style="height: 100%"
 | 
			
		||||
                id="tour_step_2"
 | 
			
		||||
            >
 | 
			
		||||
        <div class="text-center mt-2" v-if="selected_elements.length == 0">
 | 
			
		||||
                <div
 | 
			
		||||
                    class="text-center mt-2"
 | 
			
		||||
                    v-if="selected_elements.length == 0"
 | 
			
		||||
                >
 | 
			
		||||
                    <h5>{{ trans("messages.pls_add_element") }}</h5>
 | 
			
		||||
                </div>
 | 
			
		||||
                <draggable
 | 
			
		||||
@ -94,7 +130,9 @@
 | 
			
		||||
                        tag="div"
 | 
			
		||||
                        class="row"
 | 
			
		||||
                        :class="[
 | 
			
		||||
              selected_elements.length < 3 ? 'transition-card-body' : '',
 | 
			
		||||
                            selected_elements.length < 3
 | 
			
		||||
                                ? 'transition-card-body'
 | 
			
		||||
                                : '',
 | 
			
		||||
                        ]"
 | 
			
		||||
                    >
 | 
			
		||||
                        <div
 | 
			
		||||
@ -116,7 +154,12 @@
 | 
			
		||||
                                <p>
 | 
			
		||||
                                    <button
 | 
			
		||||
                                        type="button"
 | 
			
		||||
                    v-if="!_.includes(['page_break'], element.type)"
 | 
			
		||||
                                        v-if="
 | 
			
		||||
                                            !_.includes(
 | 
			
		||||
                                                ['page_break'],
 | 
			
		||||
                                                element.type
 | 
			
		||||
                                            )
 | 
			
		||||
                                        "
 | 
			
		||||
                                        class="btn btn-xs btn-secondary"
 | 
			
		||||
                                        :title="trans('messages.properties')"
 | 
			
		||||
                                        @click="openElementConfigurator()"
 | 
			
		||||
@ -194,7 +237,9 @@
 | 
			
		||||
                                            class="form-control"
 | 
			
		||||
                                            v-model="form.name"
 | 
			
		||||
                                            required
 | 
			
		||||
                      @change="generateFormSlug(form.name)"
 | 
			
		||||
                                            @change="
 | 
			
		||||
                                                generateFormSlug(form.name)
 | 
			
		||||
                                            "
 | 
			
		||||
                                        />
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
@ -215,7 +260,9 @@
 | 
			
		||||
                                <div class="row">
 | 
			
		||||
                                    <div class="col-md-12 mb-2">
 | 
			
		||||
                                        <label>
 | 
			
		||||
                      {{ trans("messages.form_name_est") }}
 | 
			
		||||
                                            {{
 | 
			
		||||
                                                trans("messages.form_name_est")
 | 
			
		||||
                                            }}
 | 
			
		||||
                                            <span class="error">*</span>
 | 
			
		||||
                                        </label>
 | 
			
		||||
                                        <input
 | 
			
		||||
@ -244,7 +291,11 @@
 | 
			
		||||
                                <div class="row mb-1">
 | 
			
		||||
                                    <div class="col-md-12">
 | 
			
		||||
                                        <label>
 | 
			
		||||
                      {{ trans("messages.form_description") }}
 | 
			
		||||
                                            {{
 | 
			
		||||
                                                trans(
 | 
			
		||||
                                                    "messages.form_description"
 | 
			
		||||
                                                )
 | 
			
		||||
                                            }}
 | 
			
		||||
                                        </label>
 | 
			
		||||
                                        <input
 | 
			
		||||
                                            type="text"
 | 
			
		||||
@ -253,6 +304,38 @@
 | 
			
		||||
                                        />
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <div class="row mb-1">
 | 
			
		||||
                                    <div class="col-md-12">
 | 
			
		||||
                                        <label>
 | 
			
		||||
                                            {{
 | 
			
		||||
                                                trans(
 | 
			
		||||
                                                    "messages.form_description_ru"
 | 
			
		||||
                                                )
 | 
			
		||||
                                            }}
 | 
			
		||||
                                        </label>
 | 
			
		||||
                                        <input
 | 
			
		||||
                                            type="text"
 | 
			
		||||
                                            class="form-control"
 | 
			
		||||
                                            v-model="form.description_ru"
 | 
			
		||||
                                        />
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <div class="row mb-1">
 | 
			
		||||
                                    <div class="col-md-12">
 | 
			
		||||
                                        <label>
 | 
			
		||||
                                            {{
 | 
			
		||||
                                                trans(
 | 
			
		||||
                                                    "messages.form_description_est"
 | 
			
		||||
                                                )
 | 
			
		||||
                                            }}
 | 
			
		||||
                                        </label>
 | 
			
		||||
                                        <input
 | 
			
		||||
                                            type="text"
 | 
			
		||||
                                            class="form-control"
 | 
			
		||||
                                            v-model="form.description_est"
 | 
			
		||||
                                        />
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <form-layout
 | 
			
		||||
                                    :selected_elements="selected_elements"
 | 
			
		||||
                                    :settings="settings"
 | 
			
		||||
@ -260,9 +343,14 @@
 | 
			
		||||
                                </form-layout>
 | 
			
		||||
                                <div class="row">
 | 
			
		||||
                                    <!-- form custom attribute -->
 | 
			
		||||
                  <div class="col-md-12" v-if="form_custom_attributes.length">
 | 
			
		||||
                                    <div
 | 
			
		||||
                                        class="col-md-12"
 | 
			
		||||
                                        v-if="form_custom_attributes.length"
 | 
			
		||||
                                    >
 | 
			
		||||
                                        <hr />
 | 
			
		||||
                    <label>{{ trans("messages.custom_attributes") }}</label>
 | 
			
		||||
                                        <label>{{
 | 
			
		||||
                                            trans("messages.custom_attributes")
 | 
			
		||||
                                        }}</label>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                    <div
 | 
			
		||||
                                        class="row form_custom_attr_field"
 | 
			
		||||
@ -275,14 +363,22 @@
 | 
			
		||||
                                                <input
 | 
			
		||||
                                                    type="text"
 | 
			
		||||
                                                    class="form-control"
 | 
			
		||||
                          v-model="form_custom_attribute.key"
 | 
			
		||||
                          :placeholder="trans('messages.key')"
 | 
			
		||||
                                                    v-model="
 | 
			
		||||
                                                        form_custom_attribute.key
 | 
			
		||||
                                                    "
 | 
			
		||||
                                                    :placeholder="
 | 
			
		||||
                                                        trans('messages.key')
 | 
			
		||||
                                                    "
 | 
			
		||||
                                                />
 | 
			
		||||
                                                <input
 | 
			
		||||
                                                    type="text"
 | 
			
		||||
                                                    class="form-control"
 | 
			
		||||
                          v-model="form_custom_attribute.value"
 | 
			
		||||
                          :placeholder="trans('messages.value')"
 | 
			
		||||
                                                    v-model="
 | 
			
		||||
                                                        form_custom_attribute.value
 | 
			
		||||
                                                    "
 | 
			
		||||
                                                    :placeholder="
 | 
			
		||||
                                                        trans('messages.value')
 | 
			
		||||
                                                    "
 | 
			
		||||
                                                />
 | 
			
		||||
                                            </div>
 | 
			
		||||
                                        </div>
 | 
			
		||||
@ -303,7 +399,11 @@
 | 
			
		||||
                                        style="margin: 28px"
 | 
			
		||||
                                    >
 | 
			
		||||
                                        <i class="fas fa-plus-circle"></i>
 | 
			
		||||
                    {{ trans("messages.add_form_custom_attribute") }}
 | 
			
		||||
                                        {{
 | 
			
		||||
                                            trans(
 | 
			
		||||
                                                "messages.add_form_custom_attribute"
 | 
			
		||||
                                            )
 | 
			
		||||
                                        }}
 | 
			
		||||
                                    </button>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
@ -318,7 +418,10 @@
 | 
			
		||||
                    >
 | 
			
		||||
                        <template
 | 
			
		||||
                            v-for="(element, index) in selected_elements"
 | 
			
		||||
              v-if="element.extras.showConfigurator && isConfiguratorOpen"
 | 
			
		||||
                            v-if="
 | 
			
		||||
                                element.extras.showConfigurator &&
 | 
			
		||||
                                isConfiguratorOpen
 | 
			
		||||
                            "
 | 
			
		||||
                        >
 | 
			
		||||
                            <fieldConfigurator
 | 
			
		||||
                                v-if="!_.includes(['page_break'], element.type)"
 | 
			
		||||
@ -326,7 +429,9 @@
 | 
			
		||||
                                :element="element"
 | 
			
		||||
                                :index="index"
 | 
			
		||||
                                :selected_elements="selected_elements"
 | 
			
		||||
                v-on:toggleConfigurator="toggleConfiguratorEvent"
 | 
			
		||||
                                v-on:toggleConfigurator="
 | 
			
		||||
                                    toggleConfiguratorEvent
 | 
			
		||||
                                "
 | 
			
		||||
                                v-on:deleteElement="deleteElement"
 | 
			
		||||
                            ></fieldConfigurator>
 | 
			
		||||
                            <div
 | 
			
		||||
@ -338,7 +443,11 @@
 | 
			
		||||
                        </template>
 | 
			
		||||
                        <div v-if="!isConfiguratorOpen">
 | 
			
		||||
                            <div class="mt-1 ml-3">
 | 
			
		||||
                {{ trans("messages.pls_add_element_to_configure") }}
 | 
			
		||||
                                {{
 | 
			
		||||
                                    trans(
 | 
			
		||||
                                        "messages.pls_add_element_to_configure"
 | 
			
		||||
                                    )
 | 
			
		||||
                                }}
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
@ -861,7 +970,9 @@ export default {
 | 
			
		||||
                        evt.added.element.type
 | 
			
		||||
                    )
 | 
			
		||||
                ) {
 | 
			
		||||
          this.settings.form_data.col_visible.push(evt.added.element.name);
 | 
			
		||||
                    this.settings.form_data.col_visible.push(
 | 
			
		||||
                        evt.added.element.name
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
@ -916,7 +1027,8 @@ export default {
 | 
			
		||||
            }).then((result) => {
 | 
			
		||||
                if (result.isConfirmed) {
 | 
			
		||||
                    let element = self.selected_elements[index];
 | 
			
		||||
          let deletedElementIndex = self.settings.form_data.col_visible.indexOf(
 | 
			
		||||
                    let deletedElementIndex =
 | 
			
		||||
                        self.settings.form_data.col_visible.indexOf(
 | 
			
		||||
                            element.name
 | 
			
		||||
                        );
 | 
			
		||||
                    self.selected_elements.splice(index, 1);
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,7 @@
 | 
			
		||||
                @include('layouts/partials/status')
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        @if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
 | 
			
		||||
        @if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
 | 
			
		||||
            <div class="row mb-5">
 | 
			
		||||
                <div class="col-12 col-sm-6 col-md-3">
 | 
			
		||||
                    <div class="info-box">
 | 
			
		||||
@ -16,20 +16,19 @@
 | 
			
		||||
 | 
			
		||||
                        <div class="info-box-content">
 | 
			
		||||
                            <span class="info-box-text">@lang('messages.forms')</span>
 | 
			
		||||
                            <span class="info-box-number">{{$form_count}}</span>
 | 
			
		||||
                            <span class="info-box-number">{{ $form_count }}</span>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
                @if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::ADMIN->value))
 | 
			
		||||
                @if (!auth()->user()->hasRole(\App\Enums\User\RoleEnum::ADMIN->value))
 | 
			
		||||
                    <div class="col-12 col-sm-6 col-md-3">
 | 
			
		||||
                        <div class="info-box">
 | 
			
		||||
                            <span class="info-box-icon bg-danger elevation-1"><i
 | 
			
		||||
                                    class="fas fa-align-justify"></i></span>
 | 
			
		||||
                            <span class="info-box-icon bg-danger elevation-1"><i class="fas fa-align-justify"></i></span>
 | 
			
		||||
 | 
			
		||||
                            <div class="info-box-content">
 | 
			
		||||
                                <span class="info-box-text">@lang('messages.templates')</span>
 | 
			
		||||
                                <span class="info-box-number">{{$template_count}}</span>
 | 
			
		||||
                                <span class="info-box-number">{{ $template_count }}</span>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
@ -41,14 +40,13 @@
 | 
			
		||||
 | 
			
		||||
                        <div class="info-box-content">
 | 
			
		||||
                            <span class="info-box-text">@lang('messages.submissions')</span>
 | 
			
		||||
                            <span class="info-box-number">{{$submission_count}}</span>
 | 
			
		||||
                            <span class="info-box-number">{{ $submission_count }}</span>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
                <div class="col-12 col-sm-6 col-md-3">
 | 
			
		||||
                    <button type="button"
 | 
			
		||||
                            data-href="{{action([\App\Http\Controllers\FormController::class, 'create'])}}"
 | 
			
		||||
                    <button type="button" data-href="{{ action([\App\Http\Controllers\FormController::class, 'create']) }}"
 | 
			
		||||
                        class="btn btn-primary float-right col-md-9 createForm mt-3">
 | 
			
		||||
                        <i class="fas fa-plus" aria-hidden="true"></i> @lang('messages.new_form')</button>
 | 
			
		||||
                </div>
 | 
			
		||||
@ -59,11 +57,9 @@
 | 
			
		||||
                <div class="card card-primary card-outline card-outline-tabs">
 | 
			
		||||
                    <div class="card-header p-0 border-bottom-0">
 | 
			
		||||
                        <ul class="nav nav-tabs
 | 
			
		||||
                        @if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
 | 
			
		||||
                            nav-justified
 | 
			
		||||
                        @endif"
 | 
			
		||||
                        @if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form) nav-justified @endif"
 | 
			
		||||
                            id="custom-tabs-four-tab" role="tablist">
 | 
			
		||||
                            @if(auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value]) || auth()->user()->can_create_form)
 | 
			
		||||
                            @if (auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value]) || auth()->user()->can_create_form)
 | 
			
		||||
                                <li class="nav-item">
 | 
			
		||||
                                    <a class="nav-link active" id="custome-tabs-all-forms" data-toggle="pill"
 | 
			
		||||
                                        href="#custome-tabs-forms" role="tab" aria-controls="custome-tabs-forms"
 | 
			
		||||
@ -71,45 +67,40 @@
 | 
			
		||||
                                        <i class="fas fa-file-alt" aria-hidden="true"></i> @lang('messages.all_forms')
 | 
			
		||||
                                    </a>
 | 
			
		||||
                                </li>
 | 
			
		||||
                                @if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::ADMIN->value))
 | 
			
		||||
                                @if (!auth()->user()->hasRole(\App\Enums\User\RoleEnum::ADMIN->value))
 | 
			
		||||
                                    <li class="nav-item">
 | 
			
		||||
                                        <a class="nav-link" id="custome-tabs-all-templates" data-toggle="pill"
 | 
			
		||||
                                            href="#custome-tabs-templates" role="tab"
 | 
			
		||||
                                            aria-controls="custome-tabs-templates">
 | 
			
		||||
                                            <i class="fas fa-align-justify"
 | 
			
		||||
                                               aria-hidden="true"></i> @lang('messages.all_templates')
 | 
			
		||||
                                            <i class="fas fa-align-justify" aria-hidden="true"></i> @lang('messages.all_templates')
 | 
			
		||||
                                        </a>
 | 
			
		||||
                                    </li>
 | 
			
		||||
                                @endif
 | 
			
		||||
                            @endif
 | 
			
		||||
                            <li class="nav-item">
 | 
			
		||||
                                <a class="nav-link
 | 
			
		||||
                                @if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) && !auth()->user()->can_create_form)
 | 
			
		||||
                                    active
 | 
			
		||||
                                @endif
 | 
			
		||||
                                " id="custome-tabs-shared-forms" data-toggle="pill"
 | 
			
		||||
                                @if (!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) && !auth()->user()->can_create_form) active @endif
 | 
			
		||||
                                "
 | 
			
		||||
                                    id="custome-tabs-shared-forms" data-toggle="pill"
 | 
			
		||||
                                    href="#custome-tabs-shared-forms-assigned" role="tab"
 | 
			
		||||
                                    aria-controls="custome-tabs-shared-forms-assigned"
 | 
			
		||||
                                   @if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) && !auth()->user()->can_create_form)
 | 
			
		||||
                                       aria-selected="true"
 | 
			
		||||
                                    @endif>
 | 
			
		||||
                                    <i class="fas fa-file-alt"
 | 
			
		||||
                                       aria-hidden="true"></i> @lang('messages.assigned_forms')
 | 
			
		||||
                                    @if (!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) && !auth()->user()->can_create_form) aria-selected="true" @endif>
 | 
			
		||||
                                    <i class="fas fa-file-alt" aria-hidden="true"></i> @lang('messages.assigned_forms')
 | 
			
		||||
                                </a>
 | 
			
		||||
                            </li>
 | 
			
		||||
                        </ul>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="card-body">
 | 
			
		||||
                        <div class="tab-content" id="custom-tabs-four-tabContent">
 | 
			
		||||
                            @if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
 | 
			
		||||
                            @if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
 | 
			
		||||
                                <div class="tab-pane fade active show" id="custome-tabs-forms" role="tabpanel"
 | 
			
		||||
                                    aria-labelledby="custome-tabs-all-forms">
 | 
			
		||||
                                    <div class="table-responsive">
 | 
			
		||||
                                        <table class="table" id="form_table" style="width: 100%;">
 | 
			
		||||
                                            <thead>
 | 
			
		||||
                                                <tr>
 | 
			
		||||
                                                <th>@lang('messages.name')</th>
 | 
			
		||||
                                                    <th>@lang('messages.description')</th>
 | 
			
		||||
                                                    <th>@lang('messages.name')</th>
 | 
			
		||||
                                                    <th>@lang('messages.created_at')</th>
 | 
			
		||||
                                                    <th>@lang('messages.submissions')</th>
 | 
			
		||||
                                                    <th>@lang('messages.action')</th>
 | 
			
		||||
@ -125,13 +116,12 @@
 | 
			
		||||
                                        <table class="table" id="template_table" style="width: 100%;">
 | 
			
		||||
                                            <thead>
 | 
			
		||||
                                                <tr>
 | 
			
		||||
                                                <th>@lang('messages.name')</th>
 | 
			
		||||
                                                    <th>@lang('messages.description')</th>
 | 
			
		||||
                                                @if(auth()->user()->can('superadmin'))
 | 
			
		||||
                                                    <th>@lang('messages.name')</th>
 | 
			
		||||
                                                    @if (auth()->user()->can('superadmin'))
 | 
			
		||||
                                                        <th>
 | 
			
		||||
                                                            @lang('messages.is_global_template')
 | 
			
		||||
                                                        <i class="fas fa-info-circle"
 | 
			
		||||
                                                           data-toggle="tooltip"
 | 
			
		||||
                                                            <i class="fas fa-info-circle" data-toggle="tooltip"
 | 
			
		||||
                                                                title="@lang('messages.is_global_template_tooltip')"></i>
 | 
			
		||||
                                                        </th>
 | 
			
		||||
                                                    @endif
 | 
			
		||||
@ -144,10 +134,9 @@
 | 
			
		||||
                                </div>
 | 
			
		||||
                            @endif
 | 
			
		||||
                            <div class="tab-pane fade
 | 
			
		||||
                                @if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || !auth()->user()->can_create_form)
 | 
			
		||||
                                    active show
 | 
			
		||||
                                @endif
 | 
			
		||||
                            " id="custome-tabs-shared-forms-assigned" role="tabpanel"
 | 
			
		||||
                                @if (!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || !auth()->user()->can_create_form) active show @endif
 | 
			
		||||
                            "
 | 
			
		||||
                                id="custome-tabs-shared-forms-assigned" role="tabpanel"
 | 
			
		||||
                                aria-labelledby="custome-tabs-shared-forms">
 | 
			
		||||
                                <div class="table-responsive">
 | 
			
		||||
                                    <table class="table" id="assigned_form_table" style="width: 100%;">
 | 
			
		||||
@ -177,17 +166,22 @@
 | 
			
		||||
 | 
			
		||||
@section('footer')
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
        $(document).ready(function () {
 | 
			
		||||
            var lang = `{{session()->get('locale')}}`
 | 
			
		||||
        $(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'
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var descColName = 'description';
 | 
			
		||||
            if (lang === 'est') {
 | 
			
		||||
                descColName = 'description_est'
 | 
			
		||||
            } else if (lang === 'ru') {
 | 
			
		||||
                descColName = 'description_ru'
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // form dataTable
 | 
			
		||||
            var form_table = $('#form_table').DataTable({
 | 
			
		||||
                processing: true,
 | 
			
		||||
@ -196,28 +190,62 @@
 | 
			
		||||
                buttons: [],
 | 
			
		||||
                dom: 'lfrtip',
 | 
			
		||||
                fixedHeader: false,
 | 
			
		||||
                aaSorting: [[2, 'desc']],
 | 
			
		||||
                "columnDefs": [
 | 
			
		||||
                    {"width": "22%", "targets": 0},
 | 
			
		||||
                    {"width": "40%", "targets": 1},
 | 
			
		||||
                    {"width": "15%", "targets": 2},
 | 
			
		||||
                    {"width": "3%", "targets": 3},
 | 
			
		||||
                    {"width": "20%", "targets": 4}
 | 
			
		||||
                aaSorting: [
 | 
			
		||||
                    [1, 'desc']
 | 
			
		||||
                ],
 | 
			
		||||
                columns: [
 | 
			
		||||
                "columnDefs": [{
 | 
			
		||||
                        "width": "22%",
 | 
			
		||||
                        "targets": 0
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        data: titleColName, 
 | 
			
		||||
                        name: titleColName, 
 | 
			
		||||
                        createdCell: function (td, cellData, rowData, row, col) {
 | 
			
		||||
                        "width": "40%",
 | 
			
		||||
                        "targets": 1
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "width": "15%",
 | 
			
		||||
                        "targets": 2
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "width": "3%",
 | 
			
		||||
                        "targets": 3
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "width": "20%",
 | 
			
		||||
                        "targets": 4
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                columns: [{
 | 
			
		||||
                        data: descColName,
 | 
			
		||||
                        name: descColName,
 | 
			
		||||
                        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},
 | 
			
		||||
                    {data: 'action', name: 'action', sortable: false}
 | 
			
		||||
                    {
 | 
			
		||||
                        data: titleColName,
 | 
			
		||||
                        name: titleColName,
 | 
			
		||||
                        createdCell: function(td, cellData, rowData, row, col) {
 | 
			
		||||
                            if (td.innerHTML.length === 0) {
 | 
			
		||||
                                td.innerHTML = rowData.name
 | 
			
		||||
                            }
 | 
			
		||||
                        },
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        data: 'created_at',
 | 
			
		||||
                        name: 'created_at'
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        data: 'data_count',
 | 
			
		||||
                        name: 'data_count',
 | 
			
		||||
                        searchable: false
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        data: 'action',
 | 
			
		||||
                        name: 'action',
 | 
			
		||||
                        sortable: false
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
@ -229,22 +257,41 @@
 | 
			
		||||
                buttons: [],
 | 
			
		||||
                dom: 'lfrtip',
 | 
			
		||||
                fixedHeader: false,
 | 
			
		||||
                columns: [
 | 
			
		||||
                    {data: 'name', name: 'name'},
 | 
			
		||||
                    {data: 'description', name: 'description'},
 | 
			
		||||
                        @if(auth()->user()->can('superadmin'))
 | 
			
		||||
                    {
 | 
			
		||||
                        data: 'is_global_template', name: 'is_global_template', sortable: false, searchable: false
 | 
			
		||||
                columns: [{
 | 
			
		||||
                        data: descColName,
 | 
			
		||||
                        name: descColName,
 | 
			
		||||
                        createdCell: function(td, cellData, rowData, row, col) {
 | 
			
		||||
                            if (td.innerHTML.length === 0) {
 | 
			
		||||
                                td.innerHTML = rowData.name
 | 
			
		||||
                            }
 | 
			
		||||
                        },
 | 
			
		||||
                    },
 | 
			
		||||
                        @endif
 | 
			
		||||
                    {
 | 
			
		||||
                        data: 'action', name: 'action', sortable: false
 | 
			
		||||
                        data: titleColName,
 | 
			
		||||
                        name: titleColName,
 | 
			
		||||
                        createdCell: function(td, cellData, rowData, row, col) {
 | 
			
		||||
                            if (td.innerHTML.length === 0) {
 | 
			
		||||
                                td.innerHTML = rowData.name
 | 
			
		||||
                            }
 | 
			
		||||
                        },
 | 
			
		||||
                    },
 | 
			
		||||
                    @if (auth()->user()->can('superadmin'))
 | 
			
		||||
                        {
 | 
			
		||||
                            data: 'is_global_template',
 | 
			
		||||
                            name: 'is_global_template',
 | 
			
		||||
                            sortable: false,
 | 
			
		||||
                            searchable: false
 | 
			
		||||
                        },
 | 
			
		||||
                    @endif {
 | 
			
		||||
                        data: 'action',
 | 
			
		||||
                        name: 'action',
 | 
			
		||||
                        sortable: false
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            //delete form
 | 
			
		||||
            $(document).on('click', '.delete_form', function () {
 | 
			
		||||
            $(document).on('click', '.delete_form', function() {
 | 
			
		||||
                var url = $(this).data("href");
 | 
			
		||||
                var result = confirm('Are You Sure?');
 | 
			
		||||
                if (result == true) {
 | 
			
		||||
@ -252,7 +299,7 @@
 | 
			
		||||
                        method: "DELETE",
 | 
			
		||||
                        url: url,
 | 
			
		||||
                        dataType: "json",
 | 
			
		||||
                        success: function (result) {
 | 
			
		||||
                        success: function(result) {
 | 
			
		||||
                            if (result.success == true) {
 | 
			
		||||
                                toastr.success(result.msg);
 | 
			
		||||
                                form_table.ajax.reload();
 | 
			
		||||
@ -265,7 +312,7 @@
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            //delete template
 | 
			
		||||
            $(document).on('click', '.delete_template', function () {
 | 
			
		||||
            $(document).on('click', '.delete_template', function() {
 | 
			
		||||
                var url = $(this).data("href");
 | 
			
		||||
                var result = confirm('Are You Sure?');
 | 
			
		||||
                if (result == true) {
 | 
			
		||||
@ -273,7 +320,7 @@
 | 
			
		||||
                        method: "DELETE",
 | 
			
		||||
                        url: url,
 | 
			
		||||
                        dataType: "json",
 | 
			
		||||
                        success: function (result) {
 | 
			
		||||
                        success: function(result) {
 | 
			
		||||
                            if (result.success == true) {
 | 
			
		||||
                                toastr.success(result.msg);
 | 
			
		||||
                                template_table.ajax.reload();
 | 
			
		||||
@ -286,39 +333,39 @@
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            // create form
 | 
			
		||||
            $(document).on('click', '.createForm', function () {
 | 
			
		||||
            $(document).on('click', '.createForm', function() {
 | 
			
		||||
                var url = $(this).data('href');
 | 
			
		||||
                $.ajax({
 | 
			
		||||
                    method: "GET",
 | 
			
		||||
                    url: url,
 | 
			
		||||
                    dataType: "html",
 | 
			
		||||
                    success: function (response) {
 | 
			
		||||
                    success: function(response) {
 | 
			
		||||
                        $("#modal_div").html(response).modal("show");
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            // create widget
 | 
			
		||||
            $(document).on('click', '.generate_widget', function () {
 | 
			
		||||
            $(document).on('click', '.generate_widget', function() {
 | 
			
		||||
                var url = $(this).data('href');
 | 
			
		||||
                $.ajax({
 | 
			
		||||
                    method: "GET",
 | 
			
		||||
                    url: url,
 | 
			
		||||
                    dataType: "html",
 | 
			
		||||
                    success: function (response) {
 | 
			
		||||
                    success: function(response) {
 | 
			
		||||
                        $("#modal_div").html(response).modal("show");
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            //copy form
 | 
			
		||||
            $(document).on('click', '.copy_form', function () {
 | 
			
		||||
            $(document).on('click', '.copy_form', function() {
 | 
			
		||||
                var url = $(this).data('href');
 | 
			
		||||
                $.ajax({
 | 
			
		||||
                    method: "GET",
 | 
			
		||||
                    url: url,
 | 
			
		||||
                    dataType: "html",
 | 
			
		||||
                    success: function (response) {
 | 
			
		||||
                    success: function(response) {
 | 
			
		||||
                        $("#modal_div").html(response).modal("show");
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
@ -332,49 +379,70 @@
 | 
			
		||||
                buttons: [],
 | 
			
		||||
                dom: 'lfrtip',
 | 
			
		||||
                fixedHeader: false,
 | 
			
		||||
                aaSorting: [[0, 'desc']],
 | 
			
		||||
                "columnDefs": [
 | 
			
		||||
                    {"width": "25%", "targets": 0},
 | 
			
		||||
                    {"width": "40%", "targets": 1},
 | 
			
		||||
                        @if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
 | 
			
		||||
                    {
 | 
			
		||||
                        "width": "15%", "targets": 2
 | 
			
		||||
                    },
 | 
			
		||||
                        @endif
 | 
			
		||||
                    {
 | 
			
		||||
                        "width": "20%",
 | 
			
		||||
                        "targets": @php echo auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) ? 3 : 2 @endphp }
 | 
			
		||||
                aaSorting: [
 | 
			
		||||
                    [0, 'desc']
 | 
			
		||||
                ],
 | 
			
		||||
                columns: [
 | 
			
		||||
                    {data: 'name', name: 'forms.name'},
 | 
			
		||||
                    {data: 'description', name: 'forms.description'},
 | 
			
		||||
                        @if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
 | 
			
		||||
                    {
 | 
			
		||||
                        data: 'created_by', name: 'forms.created_by'
 | 
			
		||||
                "columnDefs": [{
 | 
			
		||||
                        "width": "25%",
 | 
			
		||||
                        "targets": 0
 | 
			
		||||
                    },
 | 
			
		||||
                        @endif
 | 
			
		||||
                    {
 | 
			
		||||
                        data: 'action', name: 'action', sortable: false
 | 
			
		||||
                        "width": "40%",
 | 
			
		||||
                        "targets": 1
 | 
			
		||||
                    },
 | 
			
		||||
                    @if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
 | 
			
		||||
                        {
 | 
			
		||||
                            "width": "15%",
 | 
			
		||||
                            "targets": 2
 | 
			
		||||
                        },
 | 
			
		||||
                    @endif {
 | 
			
		||||
                        "width": "20%",
 | 
			
		||||
                        "targets": @php
 | 
			
		||||
                            echo auth()
 | 
			
		||||
                                ->user()
 | 
			
		||||
                                ->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value)
 | 
			
		||||
                                ? 3
 | 
			
		||||
                                : 2;
 | 
			
		||||
                        @endphp
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                columns: [{
 | 
			
		||||
                        data: 'name',
 | 
			
		||||
                        name: 'forms.name'
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        data: 'description',
 | 
			
		||||
                        name: 'forms.description'
 | 
			
		||||
                    },
 | 
			
		||||
                    @if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
 | 
			
		||||
                        {
 | 
			
		||||
                            data: 'created_by',
 | 
			
		||||
                            name: 'forms.created_by'
 | 
			
		||||
                        },
 | 
			
		||||
                    @endif {
 | 
			
		||||
                        data: 'action',
 | 
			
		||||
                        name: 'action',
 | 
			
		||||
                        sortable: false
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            //form collaborate
 | 
			
		||||
            $(document).on('click', '.collab_btn', function () {
 | 
			
		||||
            $(document).on('click', '.collab_btn', function() {
 | 
			
		||||
                var url = $(this).data('href');
 | 
			
		||||
                $.ajax({
 | 
			
		||||
                    method: "GET",
 | 
			
		||||
                    url: url,
 | 
			
		||||
                    dataType: "html",
 | 
			
		||||
                    success: function (response) {
 | 
			
		||||
                    success: function(response) {
 | 
			
		||||
                        $("#collab_modal").html(response).modal("show");
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $("#collab_modal").on('shown.bs.modal', function () {
 | 
			
		||||
            $("#collab_modal").on('shown.bs.modal', function() {
 | 
			
		||||
                if ($("#form_design").length) {
 | 
			
		||||
                    $(document).on('change', '#form_design', function () {
 | 
			
		||||
                    $(document).on('change', '#form_design', function() {
 | 
			
		||||
                        if ($("#form_design").is(":checked")) {
 | 
			
		||||
                            $("#form_view").attr('checked', true);
 | 
			
		||||
                        } else {
 | 
			
		||||
@ -384,7 +452,7 @@
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $(document).on('submit', 'form#collaborate_form', function (e) {
 | 
			
		||||
            $(document).on('submit', 'form#collaborate_form', function(e) {
 | 
			
		||||
                e.preventDefault();
 | 
			
		||||
                var data = $("form#collaborate_form").serialize();
 | 
			
		||||
                var url = $("form#collaborate_form").attr('action');
 | 
			
		||||
@ -395,7 +463,7 @@
 | 
			
		||||
                    url: url,
 | 
			
		||||
                    dataType: "json",
 | 
			
		||||
                    data: data,
 | 
			
		||||
                    success: function (response) {
 | 
			
		||||
                    success: function(response) {
 | 
			
		||||
                        ladda.stop();
 | 
			
		||||
                        if (response.success) {
 | 
			
		||||
                            $("#collab_modal").modal('hide');
 | 
			
		||||
@ -407,7 +475,7 @@
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $('a[data-toggle="pill"]').on('shown.bs.tab', function (e) {
 | 
			
		||||
            $('a[data-toggle="pill"]').on('shown.bs.tab', function(e) {
 | 
			
		||||
                var target = $(e.target).attr('href');
 | 
			
		||||
                if (target == '#custome-tabs-forms') {
 | 
			
		||||
                    if (typeof form_table != 'undefined') {
 | 
			
		||||
@ -424,17 +492,17 @@
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            @if(auth()->user()->can('superadmin'))
 | 
			
		||||
            $(document).on('click', '.toggle_global_template', function () {
 | 
			
		||||
            @if (auth()->user()->can('superadmin'))
 | 
			
		||||
                $(document).on('click', '.toggle_global_template', function() {
 | 
			
		||||
                    $.ajax({
 | 
			
		||||
                        method: "POST",
 | 
			
		||||
                    url: "{{route('toggle.global.template')}}",
 | 
			
		||||
                        url: "{{ route('toggle.global.template') }}",
 | 
			
		||||
                        dataType: "json",
 | 
			
		||||
                        data: {
 | 
			
		||||
                            is_checked: $(this).is(":checked") ? 1 : 0,
 | 
			
		||||
                            form_id: $(this).data("form_id"),
 | 
			
		||||
                        },
 | 
			
		||||
                    success: function (response) {
 | 
			
		||||
                        success: function(response) {
 | 
			
		||||
                            if (response.success) {
 | 
			
		||||
                                template_table.ajax.reload();
 | 
			
		||||
                            } else {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user