Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/ts.corals.io/frontend/pages/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/ts.corals.io/frontend/pages/settings.vue
<template>
  <div>
    <page-header title="Settings"/>
    <div v-if="form.isReady && showTimesheetSettings">
      <div class="row">
        <div :key="'timesheet_setting_'+index" v-for="(timesheetSetting,index) in getTimesheetSettings"
             style="width: 25%" class="mr-5 mb-2">
          <component
            :is="`${timesheetSetting.type[0].toUpperCase()}${timesheetSetting.type.slice(1).toLowerCase()}Type`"
            :form="form" :timesheetSetting="timesheetSetting" :index="index"></component>
        </div>
      </div>
      <div class="row">
        <div class="col-md-10"></div>
        <div class="col-md-2">
          <button @click.prevent="updateSettings" class="btn btn-md btn-success">
            <fa icon="edit"/>
            Update
          </button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import PageHeader from "@/components/layout/PageHeader";
import BooleanType from "@/components/Settings/BooleanType";
import DateType from "@/components/Settings/DateType";
import FileType from "@/components/Settings/FileType";
import NumberType from "@/components/Settings/NumberType";
import SelectType from "@/components/Settings/SelectType";
import TextareaType from "@/components/Settings/TextareaType";
import TextType from "@/components/Settings/TextType";

export default {
  name: "settings",
  components: {
    PageHeader, BooleanType, DateType, FileType,
    NumberType, SelectType, TextareaType, TextType
  },
  middleware: 'Authorization',
  data() {
    return {
      showTimesheetSettings:false,
      form: this.$form({
        timesheetSettings: [],
      }),
      formFile:this.$form({
        file:null
      }),
    }
  },
  methods: {
    getData() {
      let url = `timesheet/settings`;
      this.showTimesheetSettings = false;

      this.$axios.get(url).then(({data: response}) => {
        this.form.timesheetSettings = response.data;
        this.showTimesheetSettings = true;
      });
    },
    updateSettings() {
      this.form.timesheetSettings.forEach((setting) => {
        if (setting.type === 'FILE' && setting.value !== null) {
          this.formFile.file = setting.value;
          this.formFile.post(`timesheet/settings/${setting.id}/upload-file`);
        }
      });

      this.$axios.post(`timesheet/settings/update`, {
        timesheetSettings: this.form.timesheetSettings
      }).then(({data: response}) => {
        this.getData();
        this.$store.dispatch('GET_AND_SET_SETTINGS', {$axios: this.$axios, force: true});
        this.$toast.success(response.data.message);
      });
    }
  },
  computed: {
    getTimesheetSettings() {
      return this.form.timesheetSettings;
    }
  },
  mounted() {
    this.getData();
  },
}
</script>

Spamworldpro Mini