12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <template>
- <SmartModal
- v-if="show"
- dialog
- :title="$t('modal.edit_request')"
- @close="hideModal"
- >
- <template #body>
- <div class="flex flex-col px-2">
- <input
- id="selectLabelEditReq"
- v-model="requestUpdateData.name"
- v-focus
- class="input floating-input"
- placeholder=" "
- type="text"
- autocomplete="off"
- @keyup.enter="saveRequest"
- />
- <label for="selectLabelEditReq">
- {{ $t("action.label") }}
- </label>
- </div>
- </template>
- <template #footer>
- <span>
- <ButtonPrimary
- :label="$t('action.save')"
- :loading="loadingState"
- @click.native="saveRequest"
- />
- <ButtonSecondary
- :label="$t('action.cancel')"
- @click.native="hideModal"
- />
- </span>
- </template>
- </SmartModal>
- </template>
- <script>
- import { defineComponent } from "@nuxtjs/composition-api"
- export default defineComponent({
- props: {
- show: Boolean,
- editingRequestName: { type: String, default: null },
- loadingState: Boolean,
- },
- data() {
- return {
- requestUpdateData: {
- name: null,
- },
- }
- },
- watch: {
- editingRequestName(val) {
- this.requestUpdateData.name = val
- },
- },
- methods: {
- saveRequest() {
- if (!this.requestUpdateData.name) {
- this.$toast.error(this.$t("request.invalid_name"))
- return
- }
- this.$emit("submit", this.requestUpdateData)
- },
- hideModal() {
- this.requestUpdateData = { name: null }
- this.$emit("hide-modal")
- },
- },
- })
- </script>
|