use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema;
+use Illuminate\Support\Str;
+use Spatie\MediaLibrary\MediaCollections\Models\Media;
class MigrateCommand extends CubistMagicCommand
{
foreach ($queries as $q) {
$connection->exec($q);
}
+
+ Media::whereNull('uuid')->cursor()->each(
+ fn(Media $media) => $media->update(['uuid' => Str::uuid()])
+ );
}
/**
this.id = $(this.element).attr('id');
this.bmidselector = '[data-bmid="' + this.id + '"]';
+ this.cleanTemplate();
+
var initValues = this.element.data('values');
$.each(initValues, function (k, v) {
$this.initItem(v);
}
},
+ cleanTemplate: function () {
+ this.element.find('.sample' + this.bmidselector).find('[data-init-function]').removeAttr('data-init-function');
+ },
+
update: function () {
this.serialize();
this.updateLegends();
var $this = this;
var id = this.element.attr('id');
$.each(this.element.find('.item' + this.bmidselector + ':not(.sample) .subform' + this.bmidselector), function () {
+
+ $(this).find('.bunchmultiple').each(function () {
+ $(this).data('bunchmultiple').serialize();
+ });
+
var data = $(this).find(':input' + $this.bmidselector).serializeArray();
var filteredData = {};
$.each(data, function (k, v) {
$(this.element).find(".bunchmultiple__items" + this.bmidselector).append($(item));
this.setValues(item, values);
+
$(item).find('.subform>.bunchmultiple').bunchmultiple();
$(item).find('.form-group').find('input, select, .dropzone, textarea').each(function () {
$(this).attr('data-bmid', $this.id);
});
-
- $(document).trigger('cubist.bunchmultiple.added');
- $(this).trigger('change');
+ setTimeout(function () {
+ $this.setValues(item, values);
+ $(document).trigger('cubist.bunchmultiple.added');
+ $($this).trigger('change');
+ }, 500);
},
setValues(item, values) {
var input = $(item).find('[name="' + id + '___' + k + '"]');
if (input.is('.hiddenfield')) {
$(input).parent().attr('data-values', JSON.stringify(v));
- } else if (input.filter('[type="checkbox"]').length > 0) {
- input.filter('[type="checkbox"]').prop('checked', v === '1');
+ } else if ($(input).nextAll('[type="checkbox"]').length > 0) {
+ var cb = $(input).nextAll('[type="checkbox"]');
+ cb.attr('name', cb.prev('[type="hidden"]').attr('name')).attr('value', '1');
+ cb.prop('checked', v === true || v === '1' || v === 1);
} else {
input.val(v);
}
});
} catch (e) {
-
+ console.log(e);
}
this.updateLegends();
},