public $timestamps = true;
protected $_enableTrackNonDefaultValues = false;
- protected $_enableTracEmptyValues = false;
+ protected $_enableTrackEmptyValues = false;
protected static $_ownerAttribute = null;
if ($this->_enableTrackNonDefaultValues) {
$res[] = 'cubist_back::track-non-default-values';
}
- if ($this->_enableTracEmptyValues) {
+ if ($this->_enableTrackEmptyValues) {
$res[] = 'cubist_back::track-empty-values';
}
return array_unique($res);
continue;
}
if (!is_numeric($sectionLabel)) {
- if (!$sectionLabel || $sectionLabel=='0') {
+ if (!$sectionLabel || $sectionLabel == '0') {
$sectionLabel = '-';
}
$currentSection = $sectionLabel;
}
}
+ $i = 0;
foreach ($sections as $section => $fields) {
if (!count($fields)) {
continue;
}
- $this->addField($section, FormSection::class, $section);
+ $this->addField('s_s' . $i, FormSection::class, $section);
foreach ($fields as $field) {
- if(!$field){
+ if (!$field) {
continue;
}
$this->addField($field);
}
+ $i++;
}
}
@push('crud_fields_scripts')
<script type="text/javascript">
jQuery('document').ready(function ($) {
- alert(':)');
$(document).on('change', 'select,input,textarea', function () {
$(this).addClass('live-change')
});
function markEmptyChangedFields() {
- $('select,input,textarea').find(':not([data-empty-tracking="0"])').each(function () {
- var v = '';
+ $('[data-name]:not([data-empty-tracking="0"])').each(function () {
+ var v='undefined';
$(this).find('[name="' + $(this).data('name') + '"]').each(function () {
v = $(this).val();
});
});
$("#form_shortcuts nav a").each(function () {
- var hasNonDefault = $($(this).attr('href')).closest('.card').find('.empty').length > 0;
- if (hasNonDefault) {
+ var hasEmpty = $($(this).attr('href')).closest('.card').find('.empty').length > 0;
+ if (hasEmpty) {
$(this).addClass('empty');
} else {
$(this).removeClass('empty');