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/components/CoralsForm/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/ts.corals.io/frontend/components/CoralsForm/CoralsCheckboxes.vue
<template>
  <b-form-group :invalid-feedback="form.error(field)"
                :label="labelValue"
                :label-for="idValue"
                :label-class="required?'required-field':''"
                :description="fieldDescription"
                :state="form.state(field)">
    <b-form-checkbox-group :id="idValue" v-model="form[field]" v-bind="$attrs">
      <b-form-checkbox v-for="item in list" :value="item[listValueKey]"
                       :key="`${field}_${item[listValueKey]}`">
        {{ item[listLabelKey] }}
      </b-form-checkbox>
    </b-form-checkbox-group>
  </b-form-group>
</template>

<script>
export default {
  name: "CoralsCheckboxes",
  props: {
    list: {
      required: true
    },
    listLabelKey: {
      required: false,
      default: 'label',
    },
    listValueKey: {
      required: false,
      default: 'id'
    },
    form: {
      type: Object,
      required: true
    },
    label: {
      type: [String, Boolean],
      default: '',
      required: false,
    },
    field: {
      type: String,
      required: true,
    },
    required: {
      type: Boolean,
      default: false
    },
  },
  computed: {
    labelValue() {
      if (this.label === false) {
        return '';
      }

      if (this.label) {
        return this.label;
      }

      let label = this.field.replace('_', ' ');
      return label.charAt(0).toUpperCase() + label.slice(1);
    },
    idValue() {
      if (this.$attrs.id) {
        return this.$attrs.id;
      }

      return this.field;
    },
    fieldDescription() {
      return this.$attrs.description || '';
    }
  }
}
</script>

<style scoped>

</style>

Spamworldpro Mini