mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-09 06:04:46 +08:00
Merge pull request #7159 from G-Chubinidze/gc_SCI_10251
Inventory duplicating and stock column issues [SCI-10251]
This commit is contained in:
commit
ca26f60f7a
5 changed files with 16 additions and 4 deletions
|
@ -236,6 +236,13 @@ class RepositoriesController < ApplicationController
|
|||
render json: @tmp_repository.errors, status: :unprocessable_entity
|
||||
else
|
||||
copied_repository = @repository.copy(current_user, @tmp_repository.name)
|
||||
old_repo_stock_column = @repository.repository_columns.find_by(data_type: 'RepositoryStockValue')
|
||||
copied_repo_stock_column = copied_repository.repository_columns.find_by(data_type: 'RepositoryStockValue')
|
||||
|
||||
if old_repo_stock_column && copied_repo_stock_column
|
||||
copied_repo_stock_column.repository_stock_unit_items = old_repo_stock_column.repository_stock_unit_items
|
||||
copied_repository.save!
|
||||
end
|
||||
|
||||
if !copied_repository
|
||||
render json: { name: ['Server error'] }, status: :unprocessable_entity
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
<button type='button' class='btn btn-secondary' data-dismiss='modal'>
|
||||
{{ i18n.t('general.cancel') }}
|
||||
</button>
|
||||
<button class="btn btn-primary" @click="validateAndsaveStockValue">
|
||||
<button class="btn btn-primary" @click="validateAndsaveStockValue" :disabled="isSaving">
|
||||
{{ i18n.t('repository_stock_values.manage_modal.save_stock') }}
|
||||
</button>
|
||||
</div>
|
||||
|
@ -161,6 +161,7 @@ export default {
|
|||
units: null,
|
||||
unit: null,
|
||||
reminderEnabled: false,
|
||||
isSaving: false,
|
||||
lowStockTreshold: null,
|
||||
comment: null,
|
||||
errors: {}
|
||||
|
@ -263,6 +264,7 @@ export default {
|
|||
this.errors = newErrors;
|
||||
|
||||
if (!$.isEmptyObject(newErrors)) return;
|
||||
this.isSaving = true;
|
||||
|
||||
const $this = this;
|
||||
$.ajax({
|
||||
|
@ -282,6 +284,7 @@ export default {
|
|||
},
|
||||
success: (result) => {
|
||||
$this.stockValue = null;
|
||||
$this.isSaving = false;
|
||||
$this.closeModal();
|
||||
$this.closeCallback && $this.closeCallback(result);
|
||||
}
|
||||
|
|
|
@ -16,10 +16,12 @@
|
|||
<div class="form-group sci-input-container">
|
||||
<label><%= t("repositories.index.modal_copy.name") %></label>
|
||||
<%= f.text_field :name,
|
||||
help: t("repositories.index.modal_copy.description"),
|
||||
autofocus: true,
|
||||
class: "sci-input-field",
|
||||
placeholder: t("repositories.index.modal_copy.name_placeholder") %>
|
||||
<div class="text-red-500">
|
||||
<%= t("repositories.index.modal_copy.description") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
data: { min: 0, max: Constants::REPOSITORY_NUMBER_TYPE_MAX_DECIMALS }) %>
|
||||
</div>
|
||||
|
||||
<%= javascript_include_tag 'repository_columns/manage_column_partials/number' %>
|
||||
<%= javascript_include_tag 'repository_columns/manage_column_partials/number', nonce: true %>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
class: 'form-control stock-column',
|
||||
data: { min: 0, max: Constants::REPOSITORY_NUMBER_TYPE_MAX_DECIMALS }) %>
|
||||
|
||||
<%= javascript_include_tag 'repository_columns/manage_column_partials/stock' %>
|
||||
<%= javascript_include_tag 'repository_columns/manage_column_partials/stock', nonce: true %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
Loading…
Reference in a new issue