init
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
.mix-step-pricing-invalid-data {
|
||||
border: 1px solid #e22626;
|
||||
margin-top: 2rem;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.mix-step-pricing-invalid-data h3,
|
||||
.mix-step-pricing-invalid-data > p {
|
||||
color: #c62828;
|
||||
}
|
||||
|
||||
.mix-step-pricing-invalid-data .data-grid-th {
|
||||
background: #b71c1c;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.mix-step-pricing-invalid-data .data-row td {
|
||||
background: #fff5f5;
|
||||
}
|
||||
|
||||
.mix-step-pricing-invalid-data .data-row td:last-child {
|
||||
color: #c62828;
|
||||
font-weight: 600;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
define(['jquery'], function ($) {
|
||||
'use strict';
|
||||
|
||||
return function () {
|
||||
function readFile($input, file) {
|
||||
var reader = new FileReader(),
|
||||
$row = $input.closest('tr'),
|
||||
$preview = $row.find('[data-role="esun-ball-preview"]'),
|
||||
$image = $row.find('[data-role="esun-ball-preview-image"]');
|
||||
|
||||
reader.onload = function (event) {
|
||||
$row.find('[data-role="esun-ball-image-base64"]').val(String(event.target.result || ''));
|
||||
$row.find('[data-role="esun-ball-image-name"]').val(file.name || 'color-ball.png');
|
||||
$row.find('[data-role="esun-delete-ball-image"]').val('');
|
||||
$image.attr('src', String(event.target.result || ''));
|
||||
$preview.show();
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
$(document).on('change', '.esun-color-ball-input', function () {
|
||||
var file = this.files && this.files.length ? this.files[0] : null;
|
||||
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
|
||||
readFile($(this), file);
|
||||
});
|
||||
|
||||
$(document).on('click', '.esun-color-ball-remove', function () {
|
||||
var $row = $(this).closest('tr');
|
||||
|
||||
$row.find('[data-role="esun-ball-image-existing"]').val('');
|
||||
$row.find('[data-role="esun-ball-image-base64"]').val('');
|
||||
$row.find('[data-role="esun-ball-image-name"]').val('');
|
||||
$row.find('[data-role="esun-delete-ball-image"]').val('1');
|
||||
$row.find('.esun-color-ball-input').val('');
|
||||
$row.find('[data-role="esun-ball-preview-image"]').attr('src', '');
|
||||
$row.find('[data-role="esun-ball-preview"]').hide();
|
||||
});
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user