func (VS *Server) confirmCheckApp(c *gin.Context) {
	serviceHTML, _ := VS.getOurService(c, "h_check-app", "confirmCheckApp", "serviceHTML, _ := VS.getOurService")
	newCheck := CheckStock{
		ID:        bson.NewObjectId(),
		Date:      getTime(),
		IDService: serviceHTML.ID,
		LastPhoto: 0,
	}
	// Comprobar la checkbox
	QR, isQR := VS.getIDFromHTMLWithoutChecking(c, "qr")
	if isQR {
		oldCheck, b := VS.getChecksFromItemAndServiceID(c, QR, serviceHTML.ID, "h_check-app", "confirmCheckApp", "oldCheck, b := VS.getChecksFromItemAndServiceID")
		if b {
			newCheck.ID = oldCheck.ID
			VS.editElementInDatabaseWithRegister(c, newCheck, oldCheck, oldCheck.ID, serviceHTML.ID, "h_check-app", "confirmCheckApp", "VS.editElementInDatabaseWithRegister")
		} else {
			newCheck.IDInstance = QR
			VS.addElementToDatabaseWithRegister(c, newCheck, newCheck.ID, serviceHTML.ID, "h_check-app", "confirmCheckApp", "VS.addElementToDatabaseWithRegister")
		}
	}
	itemsReceived, _ := VS.getArrayIDFromHTMLWithoutChecking(c, "item", "Delivery")
	for _, i := range itemsReceived {
		oldCheck, isOldCheck := VS.getChecksFromItemAndServiceID(c, i, serviceHTML.ID, "h_check-app", "confirmCheckApp", "oldCheck, isOldCheck := VS.getChecksFromItemAndServiceID")
		lastPhoto := oldCheck.LastPhoto
		if !isOldCheck {
			lastPhoto = newCheck.LastPhoto
			newCheck.ID = bson.NewObjectId()
		}
		newCheck.IDInstance = i
		switch lastPhoto {
		case 0:
			newCheck.Photo1, _ = VS.getPhotoFromHTML(c, i.Hex(), i.Hex()+"1", basePath+"/local/services/"+serviceHTML.Name+"/checks/")
		case 1:
			newCheck.Photo2, _ = VS.getPhotoFromHTML(c, i.Hex(), i.Hex()+"2", basePath+"/local/services/"+serviceHTML.Name+"/checks/")
		case 2:
			newCheck.Photo3, _ = VS.getPhotoFromHTML(c, i.Hex(), i.Hex()+"3", basePath+"/local/services/"+serviceHTML.Name+"/checks/")
		case 3:
			newCheck.Photo4, _ = VS.getPhotoFromHTML(c, i.Hex(), i.Hex()+"4", basePath+"/local/services/"+serviceHTML.Name+"/checks/")
		}
		newCheck.LastPhoto = lastPhoto + 1
		if isQR {
			newCheck.ID = oldCheck.ID
			VS.editElementInDatabaseWithRegister(c, newCheck, oldCheck, oldCheck.ID, serviceHTML.ID, "h_check-app", "confirmCheckApp", "VS.addElementToDatabaseWithRegister")
		} else {
			newCheck.IDInstance = QR
			VS.addElementToDatabaseWithRegister(c, newCheck, newCheck.ID, serviceHTML.ID, "h_check-app", "confirmCheckApp", "VS.addElementToDatabaseWithRegister")
		}
	}
	// VS.goodFeedback(c)
}
// This handler adds the items form the delivery to the service
This handler adds the items form the delivery to the service
// This handler adds the items form the delivery to the service
func (VS *Server) confirmCheckApp(c *gin.Context) {
	serviceHTML, _ := VS.getOurService(c, "h_check-app", "confirmCheckApp", "serviceHTML, _ := VS.getOurService")
	newCheck := CheckStock{
		ID:        bson.NewObjectId(),
		Date:      getTime(),
		IDService: serviceHTML.ID,
		LastPhoto: 0,
	}
	QR, isQR := VS.getIDFromHTMLWithoutChecking(c, "qr")
	if isQR {
		oldCheck, b := VS.getChecksFromItemAndServiceID(c, QR, serviceHTML.ID, "h_check-app", "confirmCheckApp", "oldCheck, b := VS.getChecksFromItemAndServiceID")
		if b {
			newCheck.ID = oldCheck.ID
			VS.editElementInDatabaseWithRegister(c, newCheck, oldCheck, oldCheck.ID, serviceHTML.ID, "h_check-app", "confirmCheckApp", "VS.editElementInDatabaseWithRegister")
		} else {
			newCheck.IDInstance = QR
			VS.addElementToDatabaseWithRegister(c, newCheck, newCheck.ID, serviceHTML.ID, "h_check-app", "confirmCheckApp", "VS.addElementToDatabaseWithRegister")
		}
	}
	itemsReceived, _ := VS.getArrayIDFromHTMLWithoutChecking(c, "item", "Delivery")
	for _, i := range itemsReceived {
		oldCheck, isOldCheck := VS.getChecksFromItemAndServiceID(c, i, serviceHTML.ID, "h_check-app", "confirmCheckApp", "oldCheck, isOldCheck := VS.getChecksFromItemAndServiceID")
		lastPhoto := oldCheck.LastPhoto
		if !isOldCheck {
			lastPhoto = newCheck.LastPhoto
			newCheck.ID = bson.NewObjectId()
		}
		newCheck.IDInstance = i
		switch lastPhoto {
		case 0:
			newCheck.Photo1, _ = VS.getPhotoFromHTML(c, i.Hex(), i.Hex()+"1", basePath+"/local/services/"+serviceHTML.Name+"/checks/")
		case 1:
			newCheck.Photo2, _ = VS.getPhotoFromHTML(c, i.Hex(), i.Hex()+"2", basePath+"/local/services/"+serviceHTML.Name+"/checks/")
		case 2:
			newCheck.Photo3, _ = VS.getPhotoFromHTML(c, i.Hex(), i.Hex()+"3", basePath+"/local/services/"+serviceHTML.Name+"/checks/")
		case 3:
			newCheck.Photo4, _ = VS.getPhotoFromHTML(c, i.Hex(), i.Hex()+"4", basePath+"/local/services/"+serviceHTML.Name+"/checks/")
		}
		newCheck.LastPhoto = lastPhoto + 1
		if isQR {
			newCheck.ID = oldCheck.ID
			VS.editElementInDatabaseWithRegister(c, newCheck, oldCheck, oldCheck.ID, serviceHTML.ID, "h_check-app", "confirmCheckApp", "VS.addElementToDatabaseWithRegister")
		} else {
			newCheck.IDInstance = QR
			VS.addElementToDatabaseWithRegister(c, newCheck, newCheck.ID, serviceHTML.ID, "h_check-app", "confirmCheckApp", "VS.addElementToDatabaseWithRegister")
		}
	}
}
func ( VS * Server ) confirmCheckApp ( c * gin . Context ) { serviceHTML , _ := VS . getOurService ( c , " " , " " , " " ) newCheck := CheckStock { ID : bson . NewObjectId ( ) , Date : getTime ( ) , IDService : serviceHTML . ID , LastPhoto : 0 , } QR , isQR := VS . getIDFromHTMLWithoutChecking ( c , " " ) if isQR { oldCheck , b := VS . getChecksFromItemAndServiceID ( c , QR , serviceHTML . ID , " " , " " , " " ) if b { newCheck . ID = oldCheck . ID VS . editElementInDatabaseWithRegister ( c , newCheck , oldCheck , oldCheck . ID , serviceHTML . ID , " " , " " , " " ) } else { newCheck . IDInstance = QR VS . addElementToDatabaseWithRegister ( c , newCheck , newCheck . ID , serviceHTML . ID , " " , " " , " " ) } } itemsReceived , _ := VS . getArrayIDFromHTMLWithoutChecking ( c , " " , " " ) for _ , i := range itemsReceived { oldCheck , isOldCheck := VS . getChecksFromItemAndServiceID ( c , i , serviceHTML . ID , " " , " " , " " ) lastPhoto := oldCheck . LastPhoto if ! isOldCheck { lastPhoto = newCheck . LastPhoto newCheck . ID = bson . NewObjectId ( ) } newCheck . IDInstance = i switch lastPhoto { case 0 : newCheck . Photo1 , _ = VS . getPhotoFromHTML ( c , i . Hex ( ) , i . Hex ( ) + " " , basePath + " " + serviceHTML . Name + " " ) case 1 : newCheck . Photo2 , _ = VS . getPhotoFromHTML ( c , i . Hex ( ) , i . Hex ( ) + " " , basePath + " " + serviceHTML . Name + " " ) case 2 : newCheck . Photo3 , _ = VS . getPhotoFromHTML ( c , i . Hex ( ) , i . Hex ( ) + " " , basePath + " " + serviceHTML . Name + " " ) case 3 : newCheck . Photo4 , _ = VS . getPhotoFromHTML ( c , i . Hex ( ) , i . Hex ( ) + " " , basePath + " " + serviceHTML . Name + " " ) } newCheck . LastPhoto = lastPhoto + 1 if isQR { newCheck . ID = oldCheck . ID VS . editElementInDatabaseWithRegister ( c , newCheck , oldCheck , oldCheck . ID , serviceHTML . ID , " " , " " , " " ) } else { newCheck . IDInstance = QR VS . addElementToDatabaseWithRegister ( c , newCheck , newCheck . ID , serviceHTML . ID , " " , " " , " " ) } } }
This handler adds the items form the delivery to the service
This handler adds the items form the delivery to the service
// Comprobar la checkbox // VS.goodFeedback(c)