Skip to content

Commit

Permalink
Merge pull request #4369 from mikhailprivalov/sortingActions
Browse files Browse the repository at this point in the history
cancel receive tube
  • Loading branch information
Wellheor1 authored Oct 9, 2024
2 parents 7995fe4 + cb480f0 commit c966bc8
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
1 change: 1 addition & 0 deletions api/laboratory/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
path('receive-one-by-one', views.receive_one_by_one),
path('receive-history', views.receive_history),
path('save-defect-tube', views.save_defect_tube),
path('cancel-receive', views.cancel_receive),
]
18 changes: 17 additions & 1 deletion api/laboratory/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,25 @@ def receive_history(request):
def save_defect_tube(request):
request_data = json.loads(request.body)
data_row = request_data.get('row')
t = TubesRegistration.objects.filter(pk=int(data_row['pk'])).first()
t = TubesRegistration.objects.filter(number=int(data_row['pk'])).first()
t.is_defect = data_row['is_defect']
t.defect_text = data_row['defect_text']
t.save()
message = {"ok": "ok"}
return JsonResponse(message)


@login_required
@group_required("Получатель биоматериала")
def cancel_receive(request):
request_data = json.loads(request.body)
data_row = request_data.get('row')
t = TubesRegistration.objects.filter(number=int(data_row['pk'])).first()
t.time_recive = None
t.doc_recive = None
t.is_defect = False
t.defect_text = ""
t.save()
Log.log(t.number, 4001, request.user.doctorprofile, {"tubeNumber": t.number, "id": t.pk, "docId": request.user.doctorprofile.pk, "docFio": request.user.doctorprofile.get_fio()})
message = {"ok": "ok"}
return JsonResponse(message)
27 changes: 24 additions & 3 deletions l2-frontend/src/pages/ReceiveOneByOne.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@
<table class="table table-bordered table-responsive table-condensed">
<colgroup>
<col width="87">
<col width="245">
<col width="92">
<col width="155">
<col width="147">
<col width="180">
<col>
<col width="50">
<col width="50">
<col width="195">
<col width="235">
</colgroup>
<thead>
<tr>
Expand Down Expand Up @@ -190,6 +190,18 @@
</button>
</span>
</div>
<div
style="float: left; padding-top: 20px"
>
<button
class="btn btn-blue-nb"

type="button"
@click="cancelReceive(r)"
>
Отменить прием
</button>
</div>
</td>
</tr>
<tr v-if="receiveHistory.length === 0">
Expand Down Expand Up @@ -359,6 +371,15 @@ export default class ReceiveOneByOne extends Vue {
this.focus();
}
async cancelReceive(row) {
await this.$store.dispatch(actions.INC_LOADING);
await this.$api('/laboratory/cancel-receive', { row });
await this.loadNextN();
this.loadHistory();
await this.$store.dispatch(actions.DEC_LOADING);
this.focus();
}
// eslint-disable-next-line class-methods-use-this
changeRow(row) {
if (!row.is_defect) {
Expand Down
1 change: 1 addition & 0 deletions slog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Log(models.Model):
(11, 'Приём материала: материал принят'),
(12, 'Приём материала: материал не принят'),
(4000, 'Приём материала: замечание приёма было очищено'),
(4001, 'Приём материала: отмена приема'),
(25, 'Приём материала: печать журнала приема'),
(13, 'Ввод результатов: результат сохранен'),
(14, 'Ввод результатов: результат подтвержден'),
Expand Down

0 comments on commit c966bc8

Please sign in to comment.