|
@@ -854,27 +854,10 @@ func (this *Modules) RegisterModule_Shop() *Module {
|
|
|
Name: "",
|
|
|
Value: "",
|
|
|
CallBack: func(field *builder.DataFormField) string {
|
|
|
- return `<script>` +
|
|
|
- `function UploadProductImage(product_id, input_id) {` +
|
|
|
- `var fd = new FormData();` +
|
|
|
- `var files = $('#' + input_id)[0].files[0];` +
|
|
|
- `fd.append('action', 'shop-upload-image');` +
|
|
|
- `fd.append('id', product_id);` +
|
|
|
- `fd.append('file', files);` +
|
|
|
- `$.ajax({` +
|
|
|
- `url: '/cp/',` +
|
|
|
- `method: 'POST',` +
|
|
|
- `type: 'POST',` +
|
|
|
- `data: fd,` +
|
|
|
- `contentType: false,` +
|
|
|
- `processData: false,` +
|
|
|
- `success: function(response) {` +
|
|
|
- `console.log('resp', response);` +
|
|
|
- `}` +
|
|
|
- `});` +
|
|
|
- `}` +
|
|
|
- `</script>` +
|
|
|
- `<div class="form-group n6">` +
|
|
|
+ if data.A_id == 0 {
|
|
|
+ return ``
|
|
|
+ }
|
|
|
+ return `<div class="form-group n6">` +
|
|
|
`<div class="row">` +
|
|
|
`<div class="col-md-3">` +
|
|
|
`<label>Product images</label>` +
|
|
@@ -886,7 +869,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
|
|
|
`` +
|
|
|
`</div>` +
|
|
|
`<div class="list-button position-relative">` +
|
|
|
- `<input class="form-control" type="file" id="file" name="file" /><button type="button" class="btn btn-success btn-dynamic-remove" onclick="UploadProductImage(` + utils.IntToStr(data.A_id) + `, 'file');">Upload</button>` +
|
|
|
+ `<input class="form-control" type="file" id="file" name="file" /><button type="button" class="btn btn-success btn-dynamic-remove" onclick="fave.ShopProductsUploadImage('shop-upload-image', ` + utils.IntToStr(data.A_id) + `, 'file');">Upload</button>` +
|
|
|
`</div>` +
|
|
|
//
|
|
|
`</div>` +
|