2019-12-20 21:46:36 +08:00
|
|
|
/*
|
2019-12-23 21:40:15 +08:00
|
|
|
global ListColumnHelper ChecklistColumnHelper StatusColumnHelper SmartAnnotation I18n
|
2020-02-06 21:43:17 +08:00
|
|
|
AssetColumnHelper DateTimeHelper
|
2019-12-20 21:46:36 +08:00
|
|
|
*/
|
2019-12-05 16:19:19 +08:00
|
|
|
|
|
|
|
$.fn.dataTable.render.newRowName = function(formId, $cell) {
|
|
|
|
$cell.html(`
|
2020-01-23 20:12:58 +08:00
|
|
|
<div class="sci-input-container text-field error-icon">
|
2020-01-15 23:46:01 +08:00
|
|
|
<input class="sci-input-field"
|
2023-05-26 07:14:27 +08:00
|
|
|
id="newRepoNameField"
|
2019-12-05 16:19:19 +08:00
|
|
|
form="${formId}"
|
|
|
|
type="text"
|
2019-12-10 15:41:09 +08:00
|
|
|
name="repository_row[name]"
|
2019-12-05 16:19:19 +08:00
|
|
|
value=""
|
2020-01-09 21:57:37 +08:00
|
|
|
placeholder="${I18n.t('repositories.table.enter_row_name')}"
|
2019-12-05 16:19:19 +08:00
|
|
|
data-type="RowName">
|
|
|
|
</div>
|
|
|
|
`);
|
2019-11-18 21:04:53 +08:00
|
|
|
};
|
|
|
|
|
2019-12-05 16:19:19 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryAssetValue = function(formId, columnId, $cell) {
|
2020-02-06 21:43:17 +08:00
|
|
|
AssetColumnHelper.renderCell($cell, formId, columnId);
|
2019-11-18 21:04:53 +08:00
|
|
|
};
|
|
|
|
|
2019-12-05 16:19:19 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryTextValue = function(formId, columnId, $cell) {
|
|
|
|
$cell.html(`
|
2020-01-23 20:12:58 +08:00
|
|
|
<div class="sci-input-container text-field error-icon">
|
2020-01-15 23:46:01 +08:00
|
|
|
<input class="sci-input-field"
|
2019-12-05 16:19:19 +08:00
|
|
|
form="${formId}"
|
|
|
|
type="text"
|
|
|
|
name="repository_cells[${columnId}]"
|
|
|
|
value=""
|
2020-01-09 21:57:37 +08:00
|
|
|
placeholder="${I18n.t('repositories.table.text.enter_text')}"
|
2019-12-05 16:19:19 +08:00
|
|
|
data-type="RepositoryTextValue">
|
|
|
|
</div>`);
|
|
|
|
|
2023-04-25 21:12:19 +08:00
|
|
|
SmartAnnotation.init($cell.find('input'), false);
|
2019-11-18 21:04:53 +08:00
|
|
|
};
|
|
|
|
|
2019-12-05 16:19:19 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryListValue = function(formId, columnId, $cell) {
|
2019-12-11 21:49:14 +08:00
|
|
|
ListColumnHelper.initialListEditMode(formId, columnId, $cell);
|
2019-11-18 21:04:53 +08:00
|
|
|
};
|
|
|
|
|
2019-12-05 16:19:19 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryStatusValue = function(formId, columnId, $cell) {
|
2019-12-23 21:40:15 +08:00
|
|
|
StatusColumnHelper.initialStatusEditMode(formId, columnId, $cell);
|
2019-11-18 21:04:53 +08:00
|
|
|
};
|
2019-12-06 20:18:35 +08:00
|
|
|
|
2019-12-10 22:48:53 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryChecklistValue = function(formId, columnId, $cell) {
|
2019-12-11 21:49:14 +08:00
|
|
|
ChecklistColumnHelper.initialChecklistEditMode(formId, columnId, $cell);
|
2019-12-06 20:18:35 +08:00
|
|
|
};
|
2019-12-18 18:55:12 +08:00
|
|
|
|
2020-01-17 23:04:19 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryNumberValue = function(formId, columnId, $cell, $header) {
|
2023-06-06 15:45:00 +08:00
|
|
|
const decimals = $header.data('metadata-decimals');
|
2020-01-17 23:04:19 +08:00
|
|
|
|
2023-06-06 15:45:00 +08:00
|
|
|
let $input = $('<input>', {
|
|
|
|
class: 'sci-input-field',
|
|
|
|
form: formId,
|
|
|
|
type: 'text',
|
|
|
|
name: 'repository_cells[' + columnId + ']',
|
|
|
|
value: '',
|
|
|
|
placeholder: I18n.t('repositories.table.number.enter_number'),
|
|
|
|
'data-type': 'RepositoryNumberValue'
|
|
|
|
});
|
|
|
|
|
|
|
|
$input.on('input', function() {
|
|
|
|
const decimalsRegex = new RegExp(`^\\d*(\\.\\d{0,${decimals}})?`);
|
|
|
|
let value = this.value;
|
|
|
|
value = value.replace(/[^0-9.]/g, '');
|
|
|
|
value = value.match(decimalsRegex)[0];
|
|
|
|
this.value = value;
|
|
|
|
});
|
|
|
|
|
|
|
|
let $div = $('<div>', {
|
|
|
|
class: 'sci-input-container text-field error-icon'
|
|
|
|
}).append($input);
|
|
|
|
|
|
|
|
$cell.html($div);
|
2019-12-18 18:55:12 +08:00
|
|
|
};
|
2019-12-16 22:21:50 +08:00
|
|
|
|
|
|
|
$.fn.dataTable.render.newRepositoryDateTimeValue = function(formId, columnId, $cell) {
|
2023-11-07 18:34:34 +08:00
|
|
|
DateTimeHelper.initDateTimeEditMode(formId, columnId, $cell, 'datetime', 'RepositoryDateTimeValue');
|
2019-12-16 22:21:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
$.fn.dataTable.render.newRepositoryTimeValue = function(formId, columnId, $cell) {
|
2023-11-07 18:34:34 +08:00
|
|
|
DateTimeHelper.initDateTimeEditMode(formId, columnId, $cell, 'time', 'RepositoryTimeValue');
|
2019-12-16 22:21:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
$.fn.dataTable.render.newRepositoryDateValue = function(formId, columnId, $cell) {
|
2023-11-07 18:34:34 +08:00
|
|
|
DateTimeHelper.initDateTimeEditMode(formId, columnId, $cell, 'date', 'RepositoryDateValue');
|
2019-12-16 22:21:50 +08:00
|
|
|
};
|
|
|
|
|
2019-12-17 18:27:07 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryDateTimeRangeValue = function(formId, columnId, $cell) {
|
2023-11-07 18:34:34 +08:00
|
|
|
DateTimeHelper.initDateTimeRangeEditMode(formId, columnId, $cell, 'datetime', 'RepositoryDateTimeRangeValue');
|
2019-12-17 18:27:07 +08:00
|
|
|
};
|
|
|
|
|
2019-12-17 20:42:25 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryDateRangeValue = function(formId, columnId, $cell) {
|
2023-11-07 18:34:34 +08:00
|
|
|
DateTimeHelper.initDateTimeRangeEditMode(formId, columnId, $cell, 'date', 'RepositoryDateRangeValue');
|
2019-12-17 20:42:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
$.fn.dataTable.render.newRepositoryTimeRangeValue = function(formId, columnId, $cell) {
|
2023-11-07 18:34:34 +08:00
|
|
|
DateTimeHelper.initDateTimeRangeEditMode(formId, columnId, $cell, 'time', 'RepositoryTimeRangeValue');
|
2019-12-17 20:42:25 +08:00
|
|
|
};
|
2022-01-19 20:19:56 +08:00
|
|
|
|
|
|
|
$.fn.dataTable.render.newRepositoryStockValue = function() {
|
|
|
|
return '';
|
|
|
|
};
|