first upload all files

This commit is contained in:
NW
2023-06-11 13:14:03 +01:00
parent f14dbc52b5
commit c08b36d1b6
1705 changed files with 106852 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
export default class {
constructor(data) {
this.productPanelHtml = this.getProductPanelHtml(data);
}
getProductPanelHtml(data) {
data.product = this.normalizeAttributes(data.product);
let template = _.template($('#flash-sale-product-template').html());
return $(template(data));
}
normalizeAttributes(product) {
if ($.isEmptyObject(product)) {
return { id: null, pivot: { campaign_end: null, price: { amount: null }, qty: null } };
}
if (! $.isEmptyObject(FleetCart.errors['flash_sale.products'])) {
return {
id: product.id,
name: product.name,
pivot: { campaign_end: product.campaign_end, price: { amount: product.price }, qty: product.qty },
};
}
return product;
}
render() {
this.attachEventListeners();
window.admin.dateTimePicker(this.productPanelHtml.find('.datetime-picker'));
return this.productPanelHtml;
}
attachEventListeners() {
this.productPanelHtml.find('.delete-product-panel').on('click', () => {
this.productPanelHtml.remove();
});
}
}