mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Diferenciar naming en base a donde se invoca la descarga, OT vs PRESUPUESTO
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
|
||||
import Ajax from '../ajax.js';
|
||||
import { alertSuccessMessage } from '../alerts/sweetAlert.js'
|
||||
import { alertSuccessMessage, alertWarningMessage } from '../alerts/sweetAlert.js'
|
||||
|
||||
const PREVIEW_TEMPLATE = `
|
||||
<div class="dz-preview dz-file-preview">
|
||||
@ -25,7 +25,7 @@ const PREVIEW_TEMPLATE = `
|
||||
class FileUploadDropzone {
|
||||
|
||||
|
||||
constructor({ domElement, nameId = "presupuesto_id", getUri = null, postUri = null, resourcePath = "presupuestos" }) {
|
||||
constructor({ domElement, nameId = "presupuesto_id", getUri = null, postUri = null, resourcePath = "presupuestos", otId = null }) {
|
||||
Dropzone.autoDiscover = false;
|
||||
this.domElement = domElement
|
||||
this.jqElement = $(domElement)
|
||||
@ -35,6 +35,7 @@ class FileUploadDropzone {
|
||||
this.btnDownloadFiles = $(`#${domElement.replace('#', '')}_btnDownloadFiles`);
|
||||
this.dataPost = {}
|
||||
this.nameId = nameId;
|
||||
this.otId = otId;
|
||||
this.getUri = getUri
|
||||
this.postUri = postUri
|
||||
this.dataPost[nameId] = this.modelId;
|
||||
@ -160,7 +161,8 @@ class FileUploadDropzone {
|
||||
url: `/presupuestoadmin/download_zip`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
[this.nameId]: this.modelId
|
||||
[this.nameId]: this.modelId,
|
||||
'ot_id': this.otId
|
||||
},
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
@ -185,7 +187,7 @@ class FileUploadDropzone {
|
||||
window.URL.revokeObjectURL(url);
|
||||
},
|
||||
error: () => {
|
||||
alertWarningMessage("Error al descargar el archivo ZIP.");
|
||||
alertWarningMessage("Error", "Error al descargar el archivo ZIP.");
|
||||
},
|
||||
complete: () => {
|
||||
$("#loader").modal('hide');
|
||||
|
||||
@ -10,6 +10,7 @@ class OrdenTrabajo {
|
||||
this.otForm = this.item.find("#ot-edit-form")
|
||||
this.block = document.querySelector('.section-block');
|
||||
this.modelId = this.item.data("id");
|
||||
this.otId = parseInt($("#dropzone-ot-files").data("ot-id")) || null;
|
||||
this.tareasTableItem = this.item.find("#ot-task-table");
|
||||
this.tareasId = []
|
||||
this.summaryData = {}
|
||||
@ -70,6 +71,7 @@ class OrdenTrabajo {
|
||||
this.configUploadDropzone = {
|
||||
domElement: '#dropzone-ot-files',
|
||||
nameId: "presupuesto_id",
|
||||
otId: this.otId,
|
||||
getUri: '/presupuestos/presupuestocliente/get_files',
|
||||
postUri: '/presupuestos/presupuestocliente/upload_files'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user