NAME="$1"

MAYUS="$1"
MINUS=`echo "$1" | tr '[:upper:]' '[:lower:]'`
AMAYUS=`echo "$1" | sed -r 's/([A-Z])/_\L\1/g' | sed 's/^_//' | tr '[:lower:]' '[:upper:]'`
URL=`echo "$1" | sed -r 's/([A-Z])/-\L\1/g' | sed 's/^-//'`
MINUS=`echo "$1" | sed -r 's/([A-Z])/_\L\1/g' | sed 's/^_//'`
CAMELCASE=`echo "$1" | sed 's/./\L&/'`

# MAYUS=($MAYUS)

if [ -e "src/views/$MAYUS\s.vue" ]
then
    echo "This component already exists in this project or the name is the same"
else

# crear archivo .vue de la nueva vista
echo "<template lang=\"pug\">
  .crud(v-shortcuts=\"[{ shortcut: [ 'n', ], callback: add"$MAYUS", push: true, focus: true },]\")
    modal-import(model=\""$MINUS"s\" :title=\"\$t('front.import_modal', {model: \$t('strings."$MINUS"s')})\")
    .container-fluid
      vm-row.heading(vm-w=\"12\")
        vm-col(vm-type=\"flex\" vm-align=\"center\" vm-lg=6 vm-sm=6)
          div
            h2 \{{ \$t('strings."$MINUS"s') }}:
            span \{{ \$t('strings.description', {attribute: \$t('strings."$MINUS"s')}) }}
          div(style=\"display:none;\")
            vm-button(type=\"default\" icon=\"list\")
            vm-button(type=\"default\" icon=\"grid\" color=\"rgba(var(--gray),1)\")
        vm-col(vm-type=\"flex\" vm-align=\"center\" vm-justify=\"flex-end\" vm-lg=6 vm-sm=6)
          div
            vm-button(icon=\"plus\" @click=\"add"$MAYUS"\") \{{ \$t('strings.add') }}
            vm-tooltip(:text=\"\$t('strings.options')\" delay=\".5s\")
              vm-dropdown(vm-custom-content vm-trigger-click vm-trigger-outside-click)
                vm-button(type=\"border\" icon=\"more-horizotnal\" color=\"#afbbc6\")

                vm-dropdown-menu
                  vm-dropdown-item.d-flex.justify-content-between(@click=\"printReport\")
                    vm-icon(icon=\"printer-outline\")
                    slot &nbsp;\{{ \$t('strings.print') }}
                  vm-dropdown-item.d-flex.justify-content-between(@click=\"delete"$MAYUS"sConfirm\" :disabled=\"!enabledDelete\")
                    vm-icon(icon=\"trash-2-outline\")
                    slot &nbsp;\{{ \$t('strings.delete') }}
                  vm-dropdown-item.d-flex.justify-content-between(@click=\"setModalImportVisible(true)\")
                    vm-icon(icon=\"upload-outline\")
                    slot &nbsp;\{{ \$t('strings.import') }}
                  //- More options
                      Agrega mas acciones para colecciones de datos
      vm-row(vm-w=\"12\")
        vm-col.card(vm-sm=12)
          vm-table(multiple v-model=\"selected\"  max-height=\"350px\" :data=\""$CAMELCASE"s\")
            template(slot=\"header\")
              .d-flex.justify-content-between
                vm-input(icon=\"search\" size=\"small\" :placeholder=\"\$t('strings.search')\" v-model=\"filters.where.param\" @keyup.enter=\"applyFilter(filters)\")
                div
                  vm-select(:placeholder=\"\$t('strings.order_by')\" autocomplete v-model=\"filters.orderBy\" @change=\"applyFilter(filters)\" size=\"small\" width=\"200px\")
                    div(v-for=\"(item,index) in columns\")
                      vm-select-item(:key=\"item + ',asc'\" v-if=\"item !== ''\" :value=\"item + ',asc'\" :text=\"\$t('"$MINUS"s.'+ item) + ', asc'\")
                      vm-select-item(:key=\"item + ',desc'\" v-if=\"item !== ''\" :value=\"item + ',desc'\" :text=\"\$t('"$MINUS"s.'+ item) + ', desc'\")
                  vm-tooltip(:text=\"\$t('strings.filters')\" delay=\".5s\")
                    vm-dropdown(ref='dropdown' vm-custom-content vm-trigger-click vm-trigger-outside-click)
                      vm-button(type=\"default\" icon=\"funnel-outline\" size=\"small\")

                      vm-dropdown-menu(class=\"filters\")
                        .heading.d-flex.justify-content-between
                          h4 \{{ \$t('strings.filters') }}
                          vm-button(type=\"flat\" size=\"small\" @click=\"clearFilter\") \{{ \$t('strings.clear') }}
                        //- Add filters
                            Agrega los filtros que prefieras por ejemplo:
                            vm-select.filter(:placeholder=\"\$t('strings.multiple')\" multiple autocomplete label=\"Status\" v-model=\"filters.whereIn.status\")
                              vm-select-item(:key=\"index\" :value=\"item.value\" :text=\"item.text\" v-for=\"(item,index) in status\")
                            vm-date-picker.filter(type=\"daterange\" :label=\"\$t('"$MINUS"s.created_at')\" :placeholder=\"\$t('strings.select_date')\" @on-change=\"handleChange\" :value=\"filters.betweenDates.created_at\")
                            vm-select.filter(url=\"suppliers\" columns=\"name,etc\" :placeholder=\"\$t('strings.multiple')\" multiple autocomplete :label=\"\$t('purchase_orders.supplier_id')\" v-model=\"filters.whereIn.supplier_id\" @input-change=\"autoCompleteFunc\")
                              vm-select-item(:key=\"index\" :value=\"item.id\" :text=\"item.name\" v-for=\"(item,index) in purchaseOrdersCatalog.suppliers\")

                            NOTA: (agregar clase .filter)
                        .filter.d-flex
                          vm-button(@click=\"applyFilter(filters)\") \{{ \$t('strings.apply') }}
                  vm-tooltip(:text=\"\$t('strings.display_list')\" delay=\".5s\")
                    vm-button(type=\"default\" size=\"small\" icon=\"list\")
                  vm-tooltip(:text=\"\$t('strings.display_grid')\" delay=\".5s\")
                    vm-button(type=\"default\" size=\"small\" icon=\"grid\" color=\"rgba(var(--gray),1)\")
            template(slot=\"thead\")
              vm-th(:key=\"index\" v-if=\"column !== 'id'\" v-for=\"(column, index) in columns\") \{{ \$t('"$MINUS"s.' + column) }}
            template(slot-scope=\"{data}\")
              vm-tr(:data=\"tr\" :key=\"indextr\" v-for=\"(tr, indextr) in data\")
                vm-td(:data=\"data[indextr][column]\" :key=\"index\" v-if=\"column !== 'id'\" v-for=\"(column, index) in columns\")
                  slot(v-if=\"column == 'total' || column == 'unit_price'\")  \{{data[indextr][column] | currency }}
                  slot(v-if=\"column != 'status' && column != 'total' && column != 'unit_price'\") \{{data[indextr][column]}}
                  vm-chip(v-if=\"column == 'status'\" :color=\"colorStatus(data[indextr][column])\") \{{data[indextr]['status_display']}}
                vm-td
                  vm-dropdown(vm-custom-content vm-trigger-click vm-trigger-outside-click)
                    vm-button(type=\"flat\" icon=\"more-horizotnal\" color=\"#afbbc6\")

                    vm-dropdown-menu
                      vm-dropdown-item.d-flex.justify-content-between(@click=\"edit"$MAYUS"(data[indextr], tr)\")
                        vm-icon(icon=\"edit-2-outline\")
                        slot &nbsp;\{{ \$t('strings.edit') }}
                      vm-dropdown-item.d-flex.justify-content-between(@click=\"delete"$MAYUS"Confirm(data[indextr])\")
                        vm-icon(icon=\"trash-2-outline\")
                        slot &nbsp;\{{ \$t('strings.delete') }}
                      //- More actions
                      vm-dropdown-item.d-flex.justify-content-between(v-if=\"data[indextr]['status'] == '1'\" @click=\"setAction"$MAYUS"(data[indextr], 'send')\")
                        vm-icon(icon=\"checkmark-circle-outline\")
                        slot &nbsp;\{{ \$t('strings.send') }}

          vm-pagination(:total=\"pagination.totalPages\" v-model=\"currentPage\" goto)
          transition(name=\"enter\")
            .total-records(v-if=\"total>0\") Total: \{{ total | currency }}
</template>

<script>
import parseDeleteMany from '@/utils/parseDeleteMany'
import ModalImport from '@/components/modals/ModalImport.vue'
import { createNamespacedHelpers } from 'vuex'
const { mapGetters, mapActions } = createNamespacedHelpers('"$MAYUS"s')

export default {
  name: '"$MAYUS"s',
  components: {
    ModalImport
  },
  data: () => ({
    currentPage: 1,
    selected: [],
    enabledDelete: false,
    columns: [
      // Agrega las columnas a mostrar
    ],
    status: [
      // Agregar los estatus si maneja
      // {
      //   text: 'Pagado',
      //   value: 2,
      //   color: 'warning'
      // }
    ],
    filters: {
      // Nota: Estos campos se parsearan en el v-model de los filtros. Ver linea 60
      where: {
        // Agregar las columnas que se filtraran en el buscador
        //name_last_name: [
        //  'name',
        //  'last_name'
        //],
        //user: {
        //  email: ''
        //},
        param: ''
      },
      whereIn: {
        // Agrega las columnas que se filtraran con mas de una opcion ejemplo: status: []
      },
      whereBetween: {
        // Agrega las columnas que se filtraran entre paramentros ejemplo: priece: []
      },
      betweenDates: {
        // Agrega las columnas que se filtraran entre fechas: created_at: []
      },
      orderBy: ''
    }
  }),
  async created () {
    await this.get"$MAYUS"s(1)
    await this.get"$MAYUS"sCatalog()
  },
  methods: {
    ...mapActions([
      'delete"$MAYUS"',
      'delete"$MAYUS"s',
      'load"$MAYUS"s',
      'loadCatalog',
      'get"$MAYUS"sCatalog',
      'action"$MAYUS"',
      'setModalImportVisible',
      'printReport',
      'applyFilter',
      'clearFilter'
    ]),
    colorStatus (code) {
      return this.status.find(e => e.value === parseInt(code))['color']
    },
    add"$MAYUS" () {
      this.\$router.push({ name: 'new"$MAYUS"', params: { isAdd: true } })
    },
    edit"$MAYUS" ("$CAMELCASE", index) {
      let id = "$CAMELCASE".id
      this.\$router.push({ name: 'edit"$MAYUS"', params: { id } })
    },
    async delete"$MAYUS"Confirm ("$CAMELCASE") {
      let t = this
      this.auxDelete"$MAYUS" = () => {
        t.delete"$MAYUS"("$CAMELCASE").then(() => { t.selected = [] })
      }
      this.\$vm.dialog({
        color: 'danger',
        title: this.\$t('front.delete_modal'),
        text: this.\$t('front.delete_confirmation', { model: this.\$t('strings."$MINUS"'), attribute: this.\$t("$CAMELCASE"./*columna*/) }),
        accept: this.auxDelete"$MAYUS"
      })
    },
    async delete"$MAYUS"sConfirm () {
      let t = this
      let "$CAMELCASE"sMany = parseDeleteMany(this.selected, /*'columna'*/)
      this.auxDelete"$MAYUS" = () => {
        t.delete"$MAYUS"s("$CAMELCASE"sMany).then(() => { t.selected = [] })
      }
      this.\$vm.dialog({
        color: 'danger',
        title: this.\$t('front.delete_modal'),
        text: this.\$t('front.delete_confirmation', { model: this.\$t('strings."$MINUS"'), attribute: "$CAMELCASE"sMany.values }),
        accept: this.auxDelete"$MAYUS"
      })
    },
    async setAction"$MAYUS" (record, action) {
      record.id && this.action"$MAYUS"({ id: record.id, action })
    },
    async get"$MAYUS"s (page) {
      this.load"$MAYUS"s({ page })
    },
    autoCompleteFunc (value, url) {
      this.loadCatalog({ filter: value, url: url })
    },
    newObjectFuncModal (value) {
      //
    },
    newObjectFuncView (value) {
      //
    },
    handleChange (date) {
      // this.filters.betweenDates.created_at = date
    },
    hiddeDrop () {
      let [dropdownMenu] = this.\$refs.dropdown.\$children.filter((item) => {
        return item.hasOwnProperty('dropdownVisible')
      })
      dropdownMenu.dropdownVisible = false
    }
  },
  computed: {
    ...mapGetters([
      '"$CAMELCASE"s',
      'pagination',
      'filterParams'
    ]),
    total () {
      return this.selected.reduce((prev, cur) => prev + parseFloat(cur.total), 0).toFixed(2)
    }
  },
  watch: {
    currentPage (currentPage) {
      this.get"$MAYUS"s(currentPage)
    },
    filterParams (filter) {
      this.hiddeDrop()
      filter.length === 0 && (this.filters = {
        // Nota: Estos campos se parsearan en el v-model de los filtros. Ver linea 60
        where: {
          // Agregar las columnas que se filtraran en el buscador
          //name_last_name: [
          //  'name',
          //  'last_name'
          //],
          //user: {
          //  email: ''
          //},
          param: ''
        },
        whereIn: {
          // Agrega las columnas que se filtraran con mas de una opcion ejemplo: status: []
        },
        whereBetween: {
          // Agrega las columnas que se filtraran entre paramentros ejemplo: priece: []
        },
        betweenDates: {
          // Agrega las columnas que se filtraran entre fechas: created_at: []
        },
        includes: '', // Agrega las relaciones separados con coma y sin espacio
        orderBy: ''
      })
      this.selected = []
      this.currentPage = 1
      this.get"$MAYUS"s(this.currentPage)
    },
    selected (selected) {
      this.enabledDelete = selected.length > 0
    }
  }
}
</script>

<style lang=\"scss\">
.filters {
  .filter {
    padding: 5px 10px;
    width: 250px;
  }
}
.con-vm-tooltip {
  display: inline-block;
  float: left;
  position: relative;
}
.vm-table--header {
  padding: 10px;
  span {
    width: 100%;
    .justify-content-between {
      div:last-child {
        .vm-button {
          margin: 0 3px;
        }
        .vm-con-dropdown {
          float: left;
        }
        .con-select {
          display: inline-block;
          input {
            height: 32px;
          }
        }
      }
    }
  }
}
</style>" > src/views/$MAYUS\s.vue

# crear archivo .vue de la vista del detalle
echo "<template lang=\"pug\">
  .crud(v-shortcuts=\[{ shortcut: [ 'enter', ], callback: saveRecord, push: true, focus: true, disabled: \$v.newRecord.\$invalid },]\")
    modal-"$URL"s-detail(:detail='detail', :index='index', :is-add='isModalAdd')
    .container-fluid
      vm-row.heading(vm-w=\"12\")
        vm-col(vm-type=\"flex\" vm-align=\"center\" vm-lg=6 vm-sm=12)
          div
            h2 \{{ getTitle() }}:
        vm-col(vm-type=\"flex\" vm-align=\"center\" vm-justify=\"flex-end\" vm-lg=6 vm-sm=6)
          div
            vm-button#saveRecord.vm-con-loading__container(icon=\"save-outline\" :disabled=\"!enabledSave && \$v.newRecord.\$invalid || newRecord.status != '1'\" @click=\"saveRecord\") \{{ \$t('strings.save') }}
            vm-tooltip(:text=\"\$t('strings.options')\" delay=\".5s\")
              vm-dropdown(vm-custom-content vm-trigger-click vm-trigger-outside-click)
                vm-button(type=\"border\" icon=\"more-horizotnal\" color=\"#afbbc6\")

                vm-dropdown-menu
                  vm-dropdown-item.d-flex.justify-content-between(v-if=\"newRecord.status == '1'\" @click=\"printReportRecord(newRecord)\" :disabled=\"!enabledEdit\")
                    vm-icon(icon=\"printer-outline\")
                    slot &nbsp;\{{ \$t('strings.print') }}
                  vm-dropdown-item.d-flex.justify-content-between(v-if=\"newRecord.status == '1'\" @click=\"delete"$MAYUS"Confirm(newRecord)\" :disabled=\"!enabledDelete\")
                    vm-icon(icon=\"trash-2-outline\")
                    slot &nbsp;\{{ \$t('strings.delete') }}
                  //- More options
                      vm-dropdown-item.d-flex.justify-content-between(v-if=\"newRecord.status == '1'\" @click=\"setAction"$MAYUS"(newRecord, 'send')\")
                        vm-icon(icon=\"checkmark-circle-outline\")
                        slot &nbsp;\{{ \$t('strings.send') }}
                      Agrega mas acciones para colecciones de datos
      vm-row(vm-w=\"12\")
        vm-col.card(vm-sm=12)
          vm-row.form(vm-align=\"center\" vm-type=\"flex\" vm-w=\"12\")
            vm-col(vm-justify=\"center\", vm-align=\"center\", vm-w=3)
              b-form-group
                vm-select(url=\"customers\" columns=\"contact,etc\" createObject @create-object=\"newObjectFuncView\" autocomplete :placeholder='\$t(\""$MINUS"s.customer_id_placeholder\")' :danger=\"!\$v.newRecord.customer_id.numeric\" :danger-text=\"'Name must have at least 4 ' + \$v.newRecord.customer_id.\$params.numeric + ' letters.'\" v-model=\"newRecord.customer_id\" :label='\$t(\""$MINUS"s.customer_id\")' @input-change=\"autoCompleteFunc\" :disabled=\"newRecord.status != '1'\")
                  vm-select-item(:key=\"index\" :value=\"item.id\" :text=\"item.contact\" v-for=\"(item,index) in "$CAMELCASE"sCatalog.customers\")
            vm-col(vm-justify=\"center\", vm-align=\"center\", vm-w=4)
              b-form-group
                vm-select(:placeholder=\"\$t('strings.multiple')\" label=\"Status\" v-model=\"newRecord.status\" disabled)
                  vm-select-item(:key=\"index\" :value=\"item.value\" :text=\"item.text\" v-for=\"(item,index) in status\")
          vm-tabs
            vm-tab(vm-label=\"Details\" vm-alignment=\"fixed\")
              vm-table(multiple v-model=\"selected\"  max-height=\"350px\" :data=\"detailsList\")
                template(slot=\"header\")
                  .d-flex.justify-content-between
                    div
                    div
                      vm-tooltip(:text=\"\$t('strings.addDetail')\" delay=\".5s\")
                        vm-button(size=\"small\" icon=\"plus\" @click=\"add"$MAYUS"Detail\" :disabled=\"newRecord.status != '1'\")
                template(slot=\"thead\")
                  vm-th(:key=\"index\" v-if=\"column !== 'id'\" v-for=\"(column, index) in columns\") \{{ \$t('"$MINUS"s_detail.' + column) }}
                  vm-th
                template(slot-scope=\"{data}\")
                  vm-tr(:data=\"tr\" :key=\"indextr\" v-for=\"(tr, indextr) in data\")
                    vm-td(:data=\"data[indextr][column]\" :key=\"index\" v-if=\"column !== 'id'\" v-for=\"(column, index) in columns\")
                      slot(v-if=\"column == 'total' || column == 'unit_price'\")  \{{data[indextr][column] | currency }}
                      slot(v-if=\"column != 'status' && column != 'total' && column != 'unit_price'\") \{{data[indextr][column]}}
                      slot(v-if=\"column == 'status'\") \{{data[indextr]['status_display']}}
                    vm-td
                    vm-dropdown(vm-custom-content vm-trigger-click vm-trigger-outside-click)
                      vm-button(type=\"flat\" icon=\"more-horizotnal\" color=\"#afbbc6\")

                      vm-dropdown-menu
                        vm-dropdown-item.d-flex.justify-content-between(@click=\"edit"$MAYUS"Detail(data[indextr], indextr)\")
                          vm-icon(icon=\"edit-2-outline\")
                          slot &nbsp;\{{ \$t('strings.edit') }}
                        vm-dropdown-item.d-flex.justify-content-between(@click=\"delete"$MAYUS"DetailConfirm(data[indextr], indextr)\")
                          vm-icon(icon=\"trash-2-outline\")
                          slot &nbsp;\{{ \$t('strings.delete') }}
                        //- More actions
              vm-row(vm-align=\"flex-end\" vm-type=\"flex\" vm-justify=\"flex-end\" vm-w=\"12\")
                vm-col(vm-w=6)
                  vm-row(vm-align=\"flex-end\" vm-type=\"flex\" vm-justify=\"flex-end\" style=\"text-align: right;\")
                    vm-col
                      b Subtotal:&nbsp;&nbsp;
                      span(style=\"font-size: 1.4rem;\") \{{ subtotal | currency }}
                  vm-row(vm-align=\"flex-end\" vm-type=\"flex\" vm-justify=\"flex-end\" style=\"text-align: right;\")
                    vm-col
                      b Total:&nbsp;&nbsp;
                      span(style=\"font-size: 1.4rem;\") \{{ total | currency }}
    transition(name=\"enter\")
      .footer(v-if=\"enabledSave &\ \!\$v.newRecord.\$invalid\")
        vm-button(type=\"flat\" text-color=\"#fff\" color=\"rgb(190, 142, 241)\" @click=\"cancel\") \{{ \$t('strings.cancel') }}
        vm-button(type=\"default\" @click=\"saveRecord\") \{{ \$t('strings.save') }}
</template>

<script>
import Modal"$MAYUS"sDetail from '@/components/modals/Modal"$MAYUS"sDetail.vue'
import { required, numeric } from 'vuelidate/lib/validators' // Ver documentacion
import parseDeleteMany from '@/utils/parseDeleteMany'
import parseVuexObject from '@/utils/parseVuexObject'
import { createNamespacedHelpers } from 'vuex'
const { mapGetters, mapActions } = createNamespacedHelpers('"$MAYUS"s')

export default {
  name: '"$MAYUS"sDetail',
  components: {
    Modal"$MAYUS"sDetail
  },
  props: {
    isAdd: {
      default: false,
      type: Boolean
    }
  },
  data: () => ({
    newRecord: {
      status: 1,
      details: []
    },
    isModalAdd: true,
    detail: {},
    index: 0,
    selected: [],
    enabledSave: false,
    columns: [
      // Agrega las columnas a mostrar
    ],
    status: [
      // Agregar los estatus si maneja
      // {
      //   text: 'Pagado',
      //   value: 2,
      //   color: 'warning'
      // }
    ]
  }),
  validations: {
    newRecord: {
      //customer_id: {
      //  required,
      //  numeric
      //}
    }
  },
  async created () {
    this.init"$MAYUS"(this.newRecord)
    await this.get"$MAYUS"sCatalog()
    this.\$route.params.id && await this.get"$MAYUS"()
  },
  methods: {
    ...mapActions([
      'init"$MAYUS"',
      'add"$MAYUS"',
      'edit"$MAYUS"',
      'delete"$MAYUS"s',
      'delete"$MAYUS"Detail',
      'delete"$MAYUS"Details',
      'action"$MAYUS"',
      'load"$MAYUS"',
      'load"$MAYUS"Aux',
      'loadCatalog',
      'get"$MAYUS"sCatalog',
      'setModalVisible',
      'printReportRecord'
    ]),
    colorStatus (code) {
      return this.status.find(e => e.value === code)['color']
    },
    getTitle () {
      return this.isAdd ? this.\$t('"$MINUS"s.add') : this.\$t('"$MINUS"s.edit')
    },
    add"$MAYUS"Detail () {
      this.isModalAdd = true
      this.setModalVisible(true)
      this.detail = {}
    },
    edit"$MAYUS"Detail (detail, index) {
      this.isModalAdd = false
      this.setModalVisible(true)
      this.detail = { ...detail }
      this.index = index
    },
    async saveRecord () {
      if (!this.enabledSave) return
      this.enabledSave = false
      let t = this
      this.\$vm.loading({
        background: 'primary',
        color: '#fff',
        container: '#saveRecord',
        scale: 0.45
      })
      await this.isAdd ? this.add"$MAYUS"(this.newRecord).then(() => { t.\$router.push({ name: '"$CAMELCASE"s' }) }) : this.edit"$MAYUS"(this.newRecord).then(() => { t.\$router.push({ name: '"$CAMELCASE"s' }) })
    },
    async delete"$MAYUS"Confirm ("$CAMELCASE") {
      let t = this
      this.auxDelete"$MAYUS" = () => {
        t.delete"$MAYUS"("$CAMELCASE").then(() => { t.\$router.push({ name: '"$CAMELCASE"s' }) })
      }
      this.\$vm.dialog({
        color: 'danger',
        title: this.\$t('front.delete_modal'),
        text: this.\$t('front.delete_confirmation', { model: this.\$t('strings."$MINUS"'), attribute: this.\$t("$CAMELCASE"./*columna*/) }),
        accept: this.auxDelete"$MAYUS"
      })
    },
    async delete"$MAYUS"DetailConfirm (detail, index) {
      let t = this
      this.auxDelete"$MAYUS"Detail = () => {
        t.delete"$MAYUS"Detail({ detail, index }).then(() => { t.selected = [] })
      }
      this.\$vm.dialog({
        color: 'danger',
        title: this.\$t('front.delete_modal'),
        text: this.\$t('front.delete_confirmation', { model: this.\$t('strings."$MINUS"'), attribute: detail.id ? detail.id : index }),
        accept: this.auxDelete"$MAYUS"Detail
      })
    },
    async delete"$MAYUS"DetailsConfirm () {
      let t = this
      let "$CAMELCASE"sMany = parseDeleteMany(this.selected, 'id')
      this.auxDelete"$MAYUS"Detail = () => {
        t.delete"$MAYUS"Details("$CAMELCASE"sMany).then(() => { t.selected = [] })
      }
      this.\$vm.dialog({
        color: 'danger',
        title: this.\$t('front.delete_modal'),
        text: this.\$t('front.delete_confirmation', { model: this.\$t('strings."$MINUS"'), attribute: "$CAMELCASE"sMany.indexes }),
        accept: this.auxDelete"$MAYUS"Detail
      })
    },
    async setAction"$MAYUS" (record, action) {
      let t = this
      this.auxAction"$MAYUS" = () => {
        t.action"$MAYUS"({ id: record.id, action })
      }
      this.$vm.dialog({
        color: 'warning',
        title: this.\$t('strings."$MINUS"'),
        text: this.\$t('front.action_confirmation', { model: this.\$t('strings."$MINUS"'), action: this.\$t('"$MINUS"s.' + action) }),
        accept: this.auxAction"$MAYUS"
      })
    },
    async get"$MAYUS" (page) {
      this.load"$MAYUS"(this.\$route.params)
    },
    getCatalogAux () {
      Object.keys(this."$CAMELCASE"sCatalog).forEach(e => {
        let arr = []
        Object.keys(this.newRecord).forEach(d => {
          if (e === d) {
            arr.push({ ...this.newRecord[d] })
            this.loadCatalogAux({ url: e, data: arr })
          }
        })
        arr = []
        this.newRecord.details.map(d => {
          let dd = { ...d }
          Object.keys(dd).forEach(f => {
            let concat = \`\${f}s\`
            if (e === concat) {
              arr.push({ ...dd[f] })
              this.loadCatalogAux({ url: e, data: arr })
            }
          })
        })
      })
    },
    autoCompleteFunc (value, url) {
      this.loadCatalog({ filter: value, url: url })
    },
    newObjectFuncModal (value) {
      //
    },
    newObjectFuncView (value) {
      //
    },
    handleChange (date) {
      // this.filters.betweenDates.created_at = date
    },
    cancel () {
      this.\$router.push({ name: '"$CAMELCASE"s' })
    }
  },
  computed: {
    ...mapGetters([
      '"$CAMELCASE"',
      '"$CAMELCASE"sCatalog'
    ]),
    detailsList () {
      let t = this
      return this.newRecord.details.map(detail => {
        return detail
      })
    },
    detailsLength () {
      return this.newRecord.details.length
    },
    enabledEdit () {
      return this.newRecord.id
    },
    subtotal () {
      return this.newRecord.details.reduce((prev, cur) => prev + parseFloat(cur.total), 0).toFixed(2)
    },
    total () {
      let iva = parseFloat(this.subtotal) * 0.16
      return (parseFloat(this.subtotal) + iva).toFixed(2)
    }
  },
  watch: {
    newRecord (record) {
      Object.keys(record).length > 2 ? this.enabledSave = true : this.enabledSave = false
    },
    "$CAMELCASE" ("$CAMELCASE") {
      this.newRecord = parseVuexObject("$CAMELCASE")
      // this.getCatalogAux()
    },
    '"$CAMELCASE".details' (details) {
      this.newRecord.details = parseVuexObject(details)
    }
  }
}
</script>

<style lang=\"scss\">
.filters {
  .filter {
    padding: 5px 10px;
    width: 250px;
  }
}
.form {
  padding: 20px 10px 0;
}
.con-vm-tooltip {
  display: inline-block;
  float: left;
  position: relative;
}
.con-vm-tabs {
  padding: 10px;
  .vm-tabs--ul {
    box-shadow: none;
  }
  .vm-tabs--content {
    padding: 0;
  }
}
.vm-col {
  padding: 0 10px;
}
.vm-table--header {
  padding: 0px !important;
  span {
    width: 100%;
    .justify-content-between {
      div:last-child {
        .vm-button {
          margin: 0 3px;
          display: block;
        }
        .vm-con-dropdown {
          float: left;
        }
        .con-select {
          display: inline-block;
          input {
            height: 32px;
          }
        }
      }
    }
  }
}
</style>" > src/views/$MAYUS\sDetail.vue

# crear archivo .vue del nuevo modal
echo "<template lang=\"pug\">
  vm-prompt(@vm-cancel=\"close\" @vm-accept=\"saveRecord\" @vm-close=\"close\" :vm-accept-text=\"\$t('strings.accept')\" :vm-cancel-text=\"\$t('strings.cancel')\" :vm-is-valid=\"!\$v.detail.\$invalid\" :vm-active=\"isModalVisible\" :vm-title='getTitle')
    vm-row(vm-align=\"center\" vm-type=\"flex\" vm-justify=\"space-between\" vm-w=\"12\" v-shortcuts=\[{ shortcut: [ 'enter', ], callback: saveRecord, push: true, focus: true, disabled: \$v.detail.\$invalid },]\")
      vm-col(vm-justify=\"center\", vm-align=\"center\", vm-w=12)
        b-form-group
          vm-input(:placeholder='\$t(\""$MINUS"s.contact_placeholder\")' :danger=\"!\$v.detail.contact.minLength\" :danger-text=\"'Name must have at least 4 ' + \$v.detail.contact.\$params.minLength + ' letters.'\" v-model=\"detail.contact\" :label='\$t(\""$MINUS"s.contact\")')
</template>

<script>
import { required, minLength, email } from 'vuelidate/lib/validators' // Ver documentacion
import { createNamespacedHelpers } from 'vuex'
const { mapGetters, mapActions } = createNamespacedHelpers('"$MAYUS"s')

export default {
  name: 'Modal"$MAYUS"sDetail',
  props: {
    detail: {
      type: Object
    },
    index: {
      type: Number
    },
    isAdd: {
      default: true,
      type: Boolean
    }
  },
  validations: {
    detail: {
      // contact: {
      //   required,
      //   minLength: minLength(5)
      // },
      // email: {
      //   required,
      //   email
      // }
    }
  },
  computed: {
    ...mapGetters([
      'isModalVisible',
      '"$CAMELCASE"sCatalog'
    ]),
    getTitle () {
      return this.isAdd ? this.\$t('"$MINUS"s_detail.add') : this.\$t('"$MINUS"s_detail.edit')
    }
  },
  methods: {
    ...mapActions([
      'add"$MAYUS"Detail',
      'edit"$MAYUS"Detail',
      'setModalVisible',
      'loadCatalog'
    ]),
    saveRecord () {
      this.isAdd ? this.add"$MAYUS"Detail(this.detail) : this.edit"$MAYUS"Detail({ detail: this.detail, index: this.index })
    },
    autoCompleteFunc (value, url) {
      this.loadCatalog({ filter: value, url: url })
    },
    close () {
      this.setModalVisible(false)
    },
    watch: {
      'detail.product' (product) {
        this.detail.unit_price = product.price
      }
    }
  }
}
</script>

<style>
.vm-select--options {
  z-index: 400331 !important;
}
</style>" > src/components/modals/Modal$MAYUS\sDetail.vue

# agregar ruta

ROUTE="{\n      path: '\/"$URL"s\',\n      name: \'"$CAMELCASE"s\',\n      component: () => import(\/\* webpackChunkName:  \""$CAMELCASE"\"  \*\/ \'\@\/views\/$MAYUS\s.vue\'),\n      meta: {\n        title: Vue.i18n.translate(\'strings."$MINUS"s\', null),\n        auth: true\n      }\n    },\n    {\n      path: '\/"$URL"s\/new\',\n      name: \'new"$MAYUS"\',\n      component: () => import(\/\* webpackChunkName:  \""$CAMELCASE"\"  \*\/ \'\@\/views\/$MAYUS\sDetail.vue\'),\n      props: true,\n      meta: {\n        title: Vue.i18n.translate(\'strings."$MINUS"s,detail\', null),\n        auth: true\n      }\n    },\n    {\n      path: '\/"$URL"s\/:id\',\n      name: \'edit"$MAYUS"\',\n      component: () => import(\/\* webpackChunkName:  \""$CAMELCASE"\"  \*\/ \'\@\/views\/$MAYUS\sDetail.vue\'),\n      meta: {\n        title: Vue.i18n.translate(\'strings."$MINUS"s.detail\', null),\n        auth: true\n      }\n    },\n    \/\/ New Route"

sed -e "s/\/\/ New Route/$ROUTE/" src/router/index.js > script_tmp
mv script_tmp src/router/index.js

# agregar vuex module

echo "import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'
import app from '../../main' // import the instance
import checkResponse from '@/utils/checkResponse'
import parserFilters from '@/utils/parserFilters'
import parserSlug from '@/utils/parserSlug'

Vue.use(Vuex)

const state = {
  "$CAMELCASE"s: [],
  "$CAMELCASE": {
    details: []
  },
  pagination: {
    currentPage: 1,
    perPage: 5,
    total"$MAYUS"s: 0,
    totalPages: 0
  },
  "$CAMELCASE"sCatalog: {},
  filterParams: '',
  isModalVisible: false
}

const mutations = {
  INIT_"$AMAYUS"_DETAIL (state, payload) {
    state."$CAMELCASE" = payload
  },
  SET_"$AMAYUS"S (state, payload) {
    state."$CAMELCASE"s = payload.data

    state.pagination = {
      currentPage: payload.current_page,
      perPage: payload.per_page,
      total"$MAYUS"s: payload.total,
      totalPages: payload.last_page
    }
  },
  ADD_"$AMAYUS" (state, payload) {
    state."$CAMELCASE"s.unshift(payload)
  },
  UPDATE_"$AMAYUS" (state, payload) {
    state."$CAMELCASE" = payload
  },
  UPDATE_"$AMAYUS"_ACTION (state, payload) {
    const idx = state."$CAMELCASE"s.findIndex(u => u.id === payload.id)

    if (idx >= 0) {
      Vue.set(state."$CAMELCASE"s, idx, payload)
    }
  },
  DELETE_"$AMAYUS" (state, payload) {
    const idx = state."$CAMELCASE"s.findIndex(u => u.id === payload.id)

    if (idx >= 0) {
      Vue.delete(state."$CAMELCASE"s, idx)
    }
  },
  DELETE_"$AMAYUS"S (state, payload) {
    for (let id of payload.ids) {
      const idx = state."$CAMELCASE"s.findIndex(u => u.id === id)

      if (idx >= 0) {
        Vue.delete(state."$CAMELCASE"s, idx)
      }
    }
  },
  ADD_"$AMAYUS"_DETAIL (state, payload) {
    state."$CAMELCASE".details.unshift(payload)
  },
  UPDATE_"$AMAYUS"_DETAIL (state, { payload, idx }) {
    if (idx >= 0) {
      Vue.set(state."$CAMELCASE".details, idx, payload)
    }
  },
  DELETE_"$AMAYUS"_DETAIL (state, idx) {
    if (idx >= 0) {
      Vue.delete(state."$CAMELCASE".details, idx)
    }
  },
  DELETE_"$AMAYUS"_DETAILS (state, payload) {
    for (let idx of payload.indexes) {
      if (idx >= 0) {
        Vue.delete(state."$CAMELCASE".details, idx)
      }
    }
  },
  SET_"$AMAYUS" (state, payload) {
    state."$CAMELCASE" = payload.data
  },
  SET_MODAL_VISIBLE (state, payload) {
    state.isModalVisible = payload
  },
  SET_FILTER_PARAMS (state, payload) {
    state.filterParams = payload
  },
  SET_CATALOG (state, { object, payload }) {
    state."$CAMELCASE"sCatalog[object] = payload.data
  },
  SET_"$AMAYUS"S_CATALOG (state, payload) {
    state.applicationCatalog = { ...state."$CAMELCASE"sCatalog, ...payload }
  }
}

const actions = {
  init"$MAYUS" ({ commit }, payload) {
    commit('INIT_"$AMAYUS"_DETAIL', payload)
  },
  async load"$MAYUS"s ({ commit }, payload) {
    app.\$Progress.start()
    try {
      const response = await axios.get(\`"$URL"s?page=\${payload.page}\${state.filterParams}\`)
      const checkErrors = checkResponse(response)

      if (checkErrors) {
        app.\$Progress.fail()
        commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'strings."$MINUS"s', text: checkErrors.message }, { root: true })
      } else {
        commit('SET_"$AMAYUS"S', response.data)
      }
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  async add"$MAYUS" ({ commit }, payload) {
    const "$CAMELCASE" = {
      // columnas
    }

    app.\$Progress.start()

    try {
      const response = await axios.post('"$URL"s', "$CAMELCASE")
      const checkErrors = checkResponse(response)

      if (checkErrors) {
        app.\$Progress.fail()
        commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'strings."$MINUS"s', text: checkErrors.message }, { root: true })
      } else {
        commit('ADD_"$AMAYUS"', response.data)
        commit('SET_ACCEPT_ALERT', { color: 'success', title: 'strings."$MINUS"s', text: 'front.added_successfully', icon: 'checkmark-circle-outline' }, { root: true })
      }
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  async edit"$MAYUS" ({ commit }, payload) {
    const "$CAMELCASE" = {
      // columnas
    }

    app.\$Progress.start()

    try {
      const response = await axios.put(\`"$URL"s/\${payload.id}\`, "$CAMELCASE")
      const checkErrors = checkResponse(response)

      if (checkErrors) {
        app.\$Progress.fail()
        commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'strings."$MINUS"s', text: checkErrors.message }, { root: true })
      } else {
        commit('UPDATE_"$AMAYUS"', response.data)
        commit('SET_ACCEPT_ALERT', { color: 'success', title: 'strings."$MINUS"s', text: 'front.updated_successfully', icon: 'checkmark-circle-outline' }, { root: true })
      }
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  async delete"$MAYUS" ({ commit }, payload) {
    app.\$Progress.start()
    try {
      const response = await axios.delete(\`"$URL"s/\${payload.id}\`)
      const checkErrors = checkResponse(response)

      if (checkErrors) {
        app.\$Progress.fail()
        commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'strings."$MINUS"s', text: checkErrors.message }, { root: true })
      } else {
        commit('DELETE_"$AMAYUS"', payload)
        commit('SET_ACCEPT_ALERT', { color: 'success', title: 'strings."$MINUS"s', text: 'front.deleted_successfully', icon: 'checkmark-circle-outline' }, { root: true })
      }
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  async delete"$MAYUS"s ({ commit }, payload) {
    app.\$Progress.start()
    try {
      const response = await axios.delete(\`"$URL"s/delete\`, { params: { ids: payload.ids } })
      const checkErrors = checkResponse(response)

      if (checkErrors) {
        app.\$Progress.fail()
        commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'strings."$MINUS"s', text: checkErrors.message }, { root: true })
      } else {
        commit('DELETE_"$AMAYUS"S', payload)
        commit('SET_ACCEPT_ALERT', { color: 'success', title: 'strings."$MINUS"s', text: 'front.deleted_successfully', icon: 'checkmark-circle-outline' }, { root: true })
      }
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  async add"$MAYUS"Detail ({ commit }, payload) {
    app.\$Progress.start()
    const "$MAYUS"Detail = {
      // Columnas
    }
    commit('ADD_"$AMAYUS"_DETAIL', "$MAYUS"Detail)
    commit('SET_MODAL_VISIBLE', false)
    app.\$Progress.finish()
  },
  async edit"$MAYUS"Detail ({ commit }, payload) {
    app.\$Progress.start()
    const "$MAYUS"Detail = {
      id: payload.detail.id,
      // columnas
    }
    commit('UPDATE_"$AMAYUS"_DETAIL', { payload: "$MAYUS"Detail, idx: payload.index })
    commit('SET_MODAL_VISIBLE', false)
    app.\$Progress.finish()
  },
  async delete"$MAYUS"Detail ({ commit }, payload) {
    app.\$Progress.start()
    commit('DELETE_"$AMAYUS"_DETAIL', payload.index)
    app.\$Progress.finish()
  },
  async delete"$MAYUS"Details ({ commit }, payload) {
    app.\$Progress.start()
    commit('DELETE_"$AMAYUS"_DETAILS', payload)
    app.\$Progress.finish()
  },
  async load"$MAYUS" ({ commit }, payload) {
    app.\$Progress.start()
    try {
      const response = await axios.get(\`"$URL"s/\${payload.id}\`)
      const checkErrors = checkResponse(response)

      if (checkErrors) {
        app.\$Progress.fail()
        commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'strings."$MINUS"s', text: checkErrors.message }, { root: true })
      } else {
        commit('SET_"$AMAYUS"', response.data)
      }
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  async action"$MAYUS" ({ commit }, payload) {
    app.\$Progress.start()
    try {
      const response = await axios.put(\`"$URL"s/\${payload.id}/\${payload.action}\`)
      const checkErrors = checkResponse(response)

      if (checkErrors) {
        app.\$Progress.fail()
        commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'strings."$MINUS"s', text: checkErrors.message }, { root: true })
      } else {
        commit('UPDATE_"$AMAYUS"', response.data)
        commit('UPDATE_"$AMAYUS"_ACTION', response.data)
        commit('SET_ACCEPT_ALERT', { color: 'success', title: 'strings."$MINUS"s', text: \`"$MINUS"s.\${payload.action}\`, icon: 'checkmark-circle-outline' }, { root: true })
      }
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  printReport ({ commit }, payload) {
    app.\$Progress.start()
    try {
      window.open(axios.defaults.baseURL + '/"$URL"s/export?' + state.filterParams)
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  printReportRecord ({ commit }, payload) {
    app.\$Progress.start()
    try {
      window.open(\`\${axios.defaults.baseURL}/"$URL"s/\${payload.id}/export\`)
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  applyFilter ({ commit }, payload) {
    const filter = parserFilters(payload)
    commit('SET_FILTER_PARAMS', filter)
  },
  clearFilter ({ commit }, payload) {
    const filter = ''
    commit('SET_FILTER_PARAMS', filter)
  },
  async loadCatalog ({ commit }, payload) {
    let url = parserSlug(payload.url)
    app.\$Progress.start()
    try {
      const response = await axios.get(\`\${url}\${payload.filter}\`)
      const checkErrors = checkResponse(response)

      if (checkErrors) {
        app.\$Progress.fail()
        commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'strings."$MINUS"s', text: checkErrors.message }, { root: true })
      } else {
        commit('SET_CATALOG', { object: payload.url, payload: response.data })
      }
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  async load"$MAYUS"sCatalog ({ commit }, payload) {
    app.\$Progress.start()
    try {
      const response = await axios.get(\`"$URL"s/catalog\`)
      const checkErrors = checkResponse(response)

      if (checkErrors) {
        app.\$Progress.fail()
        commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'strings."$MINUS"s', text: checkErrors.message }, { root: true })
      } else {
        commit('SET_APPLICATION_CATALOG', response.data)
      }
    } catch (e) {
      app.\$Progress.fail()
      commit('SET_ALERT_MESSAGE', { color: 'danger', title: 'errors.connection_error', text: 'errors.generic_error' }, { root: true })
    } finally {
      app.\$Progress.finish()
    }
  },
  loadCatalogAux ({ commit }, payload) {
    commit('SET_CATALOG', { object: payload.url, payload: payload })
  },
  setModalVisible ({ commit }, payload) {
    commit('SET_MODAL_VISIBLE', payload)
  },
  setModalImportVisible ({ commit }, payload) {
    commit('SET_MODAL_IMPORT_VISIBLE', payload, { root: true })
  }
}

const getters = {
  "$CAMELCASE": state => state."$CAMELCASE",
  "$CAMELCASE"s: state => state."$CAMELCASE"s,
  "$CAMELCASE"sCatalog: state => state."$CAMELCASE"sCatalog,
  pagination: state => state.pagination,
  isModalVisible: state => state.isModalVisible,
  filterParams: state => state.filterParams
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}" > src/store/modules/$MAYUS\s.js


# agregar tests

echo "import Vue from 'vue'
import { mount } from '@vue/test-utils'
import faker from 'faker'

import configStore from '../mocks/config-store'
import storeMock from '../mocks/store-mock'

import "$MAYUS"s from '@/views/"$MAYUS"s.vue'

const mock"$MAYUS"s = []

for (let i = 0; i < 10; i++) {
  mock"$MAYUS"s.push({
    id: faker.random.number(),
    // campos
  });
}

Vue.prototype.\$auth = {
  check: jest.fn(),
  ready: jest.fn(),
  user: jest.fn(() => ({
    name,
  }))
}

jest.doMock('axios', () => {
  return {
    get: jest.fn(() => Promise.resolve({
      status: 200,
      data: {
        data: mock"$MAYUS"s,
      },
    })),
  };
});

storeMock.state = {
  user: {
    name: faker.name.findName(),
    view_permissions: 'Admin',
  }
}

storeMock.modules."$MAYUS"s.actions = {
  delete"$MAYUS": jest.fn(),
  delete"$MAYUS"s: jest.fn(),
  load"$MAYUS"s: jest.fn(),
  load"$MAYUS": jest.fn(),
  loadCatalog: jest.fn(),
  load"$MAYUS"sCatalog: jest.fn(),
  action"$MAYUS": jest.fn(),
  setModalVisible: jest.fn(),
  printReport: jest.fn(),
  applyFilter: jest.fn(),
  clearFilter: jest.fn(),
}

storeMock.modules."$MAYUS"s.state."$CAMELCASE"s = mock"$MAYUS"s;

describe('"$MAYUS"s.vue', () => {

  const store = configStore(Vue, storeMock)
  beforeEach(() => {
    jest.resetModules()
    jest.clearAllMocks()
  })

  it('should render correct contents', (done) => {
    const wrapper = mount("$MAYUS"s, {
      store,
    })

    setTimeout(() => {
      expect(wrapper.findAll('.tr-table')).toHaveLength(mock"$MAYUS"s.length)
      expect(wrapper.findAll('.vm-table--td span').at(0).text()).toEqual(mock"$MAYUS"s[0].contact);

      done()
    }, 1500)
  })

})" > tests/unit/views/$MINUS\s.spec.js

UNIT=""$MAYUS"s: {\n      namespaced: true,\n      state: {\n        "$CAMELCASE"s: [],\n        "$CAMELCASE": {\n          details: []\n        },\n        pagination: {\n           currentPage: 1,\n         perPage: 5,\n         total"$MAYUS"s: 10,\n         totalPages: 1,\n        },\n        "$CAMELCASE"sCatalog: {},\n        filterParams: \'\',\n        isModalVisible: false\n      },\n      getters: {\n        "$CAMELCASE": state => state."$CAMELCASE",\n        "$CAMELCASE"s: state => state."$CAMELCASE"s,\n        "$CAMELCASE"sCatalog: state => state."$CAMELCASE"sCatalog,\n        pagination: state => state.pagination,\n        isModalVisible: state => state.isModalVisible,\n        filterParams: state => state.filterParams\n      }\n    },\n    \/\/ New Module"

sed -e "s/\/\/ New Module/$UNIT/" tests/unit/mocks/store-mock.js > script_tmp
mv script_tmp tests/unit/mocks/store-mock.js


E2E="\'"$MAYUS"s\': browser => {\n\t\t\browser\n\r\t\t\t .useXpath()\n\r\t\t\t .click(\"\/\/a[normalize-space()=\'"$MAYUS"s\']\")\n\r\t\t\t\ .useCss()\n\r\t\t\t .pause(5000)\n\r\t\t\t .assert.elementPresent(\'.crud\')\n\t\t\t.assert.containsText(\'.heading h2\', \'"$MAYUS"s:\')\n    },\n  \/\/ New Test"

sed -e "s/\/\/ New Test/$E2E/" tests/e2e/specs/test.js > script_tmp
mv script_tmp tests/e2e/specs/test.js

echo 'finish successfully'
fi
