task_ui/components/TeamForm.vue
2025-04-21 11:49:42 +03:30

136 lines
3.1 KiB
Vue

<template>
<div class="sign-up__form">
<div class="sign-up__form-inputs">
<div class="sign-up__row sign-up__simple-input">
<div class="form-group position-relative">
<label for="">عنوان:</label>
<input
class="form-control elem__placeholder-gray"
v-model.trim="value.title"
type="text"
placeholder="عنوان"
autocomplete="on"
/>
</div>
</div>
<div class="sign-up__row sign-up__simple-input">
<div class="form-group position-relative">
<label for="">سازمان:</label>
<input
class="form-control elem__placeholder-gray"
v-model.trim="value.organ"
type="text"
placeholder="سازمان"
autocomplete="on"
/>
</div>
<div class="d-flex justify-content-end">
<div class="sign-up__btn-container ms-3">
<a @click="closeForm()" class="btn">انصراف</a>
</div>
<button class="btn btn-primary" @click="submit()">
<the-button-loading v-if="loading"></the-button-loading>
<template v-if="value.id">
{{ $t("Update") }}
</template>
<template v-else>
{{ $t("Save") }}
</template>
</button>
</div>
</div>
</div>
</div>
</template>
<script>
// import taskApi from "@apis/taskApi";
import HttpService from "@services/httpService";
export default {
beforeMount() {
this.httpService = new HttpService( this.taskMicroServiceName
);
},
props: {
parentLoading: false,
teamData: {
default() {
return {
id: undefined,
organ: null,
title: null,
};
},
},
},
watch: {
teamData(newValu) {
this.value = newValu;
},
parentLoading(newVal) {
this.loading = newVal;
},
},
mounted() {
this.value = this.teamData;
},
data() {
return {
// organ: "",
// title: "",
loading: this.parentLoading,
value: {
id: undefined,
organ: null,
title: null,
},
};
},
computed: {
taskMicroServiceName() {
return process.env.VUE_APP_TASK;
},
},
methods: {
submit() {
this.loading = true;
this.$emit("on-pass-by-emit", this.value);
},
// addTeams() {
// this.$emit("add-teams");
// },
closeForm() {
this.$emit("close-form");
},
// getGroups() {
// this.$emit("get-groups");
// },
// addTeams() {
// let url = taskApi.taskTeams.add;
// let payload = {
// title: this.value.title,
// organ: this.value.organ,
// };
// this.httpService
// .postRequest(url, payload)
// .then((res) => {
// this.mySwalToast({
// html: res.message,
// });
// })
// .finally(() => {
// this.getGroups();
// });
// },
},
};
</script>
<style scoped lang="scss">
// input::placeholder {
// color: #d7d7d7;
// }
</style>