diff --git a/src/views/KaryawanEdit.vue b/src/views/KaryawanEdit.vue index ec91f899d126da35baad0bd93b2dd789cd50ca2f..596ec0716e0601b884686843e38514575597aa6e 100644 --- a/src/views/KaryawanEdit.vue +++ b/src/views/KaryawanEdit.vue @@ -236,8 +236,11 @@ export default { //cari id atasan let atasan_id = null + console.log(this.employee.manager) + if (this.employee.manager != "" ){ this.atasan.forEach(a => { if (a.name == this.employee.manager){ + console.log("in") atasan_id = a.id this.employee.manager_id = a.id } @@ -246,6 +249,9 @@ export default { alert(`Atasan tidak ditemukan dalam departemen ${this.dept_in}`) return } + }else if (this.employee.manager == ""){ + this.employee.manager_id = null + } // let formValue = [this.nama, this.nik, this.deptId, this.jbt, atasan_id, this.username, this.email, this.password] @@ -290,7 +296,7 @@ export default { this.nama = user.name this.nik = user.nik this.dept_in = user.department - this.deptId = user.dept_id + this.deptId = user.department_id this.jbt = user.position this.atasan_id = user.manager_id this.username = user.user.username diff --git a/src/views/KpiDetail.vue b/src/views/KpiDetail.vue index e69b38d1a6093160fb8912162fe855a9b870fe86..8efcac04512a8a4f330e4e3ebbd0e8ce10a062a5 100644 --- a/src/views/KpiDetail.vue +++ b/src/views/KpiDetail.vue @@ -79,11 +79,14 @@ <label class="form-check-label text-blue ms-2" for="CheckDefault">Target Inverted </label> </div> </div> - <div> - <button @click="responses " class="btn float-end">Responses</button> - </div> + </div> </form> + <div class="row p-3"> + <div class="col"> + <button @click="responses" class="btn float-end">Responses</button> + </div> + </div> <div class="row p-3"> <h1 class="text-blue">Buat Response</h1> <hr class="my-2"> @@ -100,7 +103,14 @@ <label class="text-blue"> Bukti </label> <input type="file" accept="image/*" class="form-control" @change="onUpload" required> </div> - <button type="submit" class="btn p-1" >Simpan</button> + <div class="row"> + <div class="col-md-auto"> + <button type="submit" class="btn p-1" >Simpan</button> + </div> + <div v-show="sending" class="col p-2"> + <p class="text-blue">Mengirimkan response...</p> + </div> + </div> </form> </div> @@ -134,9 +144,10 @@ export default { description : "", status : "pending", date : "", - images:[] + images:[], }, - nav_active : JSON.parse(localStorage.getItem('navActive')), + nav_active : JSON.parse(localStorage.getItem('navActive')), + sending : false, } }, methods: { @@ -158,12 +169,17 @@ export default { formData.append("status", this.response.status); formData.append("date", this.response.date); formData.append("images[0]", this.response.images[0]); + this.sending = true HTTP.post("kpi-responses", formData).then(()=>{ alert("Berhasil Membuat Response") document.getElementById("formResponse").reset(); + this.response.actual = 0; + this.response.description = ""; + this.sending = false }).catch((e)=>{ console.log(e.response.data) alert("Gagal Membuat Response") + this.sending = false }) }, onUpload(e){ @@ -173,7 +189,9 @@ export default { // this.item.imageUrl = URL.createObjectURL(file) }, responses(){ - this.$router.push({ path: `/kpi/${this.kpi_id}/responses`}) + // this.$router.push({ path: `/kpi/${this.kpi_id}/responses`}) + // console.log(this.kpi_id) + this.$router.push({ name: "KpiResponses", params: {kpiId:this.kpi_id}}) }