func (VS *Server) toViewWorkerOrders(c *gin.Context, orders []WorkerOrder) []WorkerOrderHTML {
	var ordersHTML []WorkerOrderHTML
	var ord WorkerOrderHTML
	for i := 0; i < len(orders); i++ {
		ord.ID = orders[i].ID
		ord.ItemID = orders[i].IDProduct

		//Here adds the Date
		ord.Date = strconv.Itoa(time.Unix(orders[i].Date, 0).Day()) + "/" + time.Unix(orders[i].Date, 0).Month().String()

		//Here adds the Product
		product, _ := VS.getVideoCourseByID(c, orders[i].IDProduct, "h_view", "toViewWorkerOrders", "product, _ := VS.getVideoCourseByID", true)
		ord.ItemName = product.Name
		ord.Photo = "/local/video-courses/" + product.Name + "/" + product.Photo

		//Here adds the Worker
		worker := VS.getUserByID(c, orders[i].IDWorker, "h_view", "toViewWorkerOrders", "worker := VS.getUserByID")
		ord.WorkerPhoto = worker.Photo
		ord.Name = worker.Name + " " + worker.Surname

		//Here adds the Quantity
		ord.Quantity = orders[i].Quantity

		//Here adds the status
		ord.Status = strconv.Itoa((orders[i].AlreadyMade * 100) / orders[i].Quantity)
		ord.Status += "%"
		ordersHTML = append(ordersHTML, ord)
	}
	return ordersHTML
}
// This method takes an array of WorkerOrder and returns an array of WorkerOrderHTML
// so we can represent the information as human readable in the website.
This method takes an array of WorkerOrder and returns an array of WorkerOrderHTML
so we can represent the information as human readable in the website.
// This method takes an array of WorkerOrder and returns an array of WorkerOrderHTML // so we can represent the information as human readable in the website .
func (VS *Server) toViewWorkerOrders(c *gin.Context, orders []WorkerOrder) []WorkerOrderHTML {
	var ordersHTML []WorkerOrderHTML
	var ord WorkerOrderHTML
	for i := 0; i < len(orders); i++ {
		ord.ID = orders[i].ID
		ord.ItemID = orders[i].IDProduct
		ord.Date = strconv.Itoa(time.Unix(orders[i].Date, 0).Day()) + "/" + time.Unix(orders[i].Date, 0).Month().String()
		product, _ := VS.getVideoCourseByID(c, orders[i].IDProduct, "h_view", "toViewWorkerOrders", "product, _ := VS.getVideoCourseByID", true)
		ord.ItemName = product.Name
		ord.Photo = "/local/video-courses/" + product.Name + "/" + product.Photo
		worker := VS.getUserByID(c, orders[i].IDWorker, "h_view", "toViewWorkerOrders", "worker := VS.getUserByID")
		ord.WorkerPhoto = worker.Photo
		ord.Name = worker.Name + " " + worker.Surname
		ord.Quantity = orders[i].Quantity
		ord.Status = strconv.Itoa((orders[i].AlreadyMade * 100) / orders[i].Quantity)
		ord.Status += "%"
		ordersHTML = append(ordersHTML, ord)
	}
	return ordersHTML
}
func ( VS * Server ) toViewWorkerOrders ( c * gin . Context , orders [ ] WorkerOrder ) [ ] WorkerOrderHTML { var ordersHTML [ ] WorkerOrderHTML var ord WorkerOrderHTML for i := 0 ; i < len ( orders ) ; i ++ { ord . ID = orders [ i ] . ID ord . ItemID = orders [ i ] . IDProduct ord . Date = strconv . Itoa ( time . Unix ( orders [ i ] . Date , 0 ) . Day ( ) ) + " " + time . Unix ( orders [ i ] . Date , 0 ) . Month ( ) . String ( ) product , _ := VS . getVideoCourseByID ( c , orders [ i ] . IDProduct , " " , " " , " " , true ) ord . ItemName = product . Name ord . Photo = " " + product . Name + " " + product . Photo worker := VS . getUserByID ( c , orders [ i ] . IDWorker , " " , " " , " " ) ord . WorkerPhoto = worker . Photo ord . Name = worker . Name + " " + worker . Surname ord . Quantity = orders [ i ] . Quantity ord . Status = strconv . Itoa ( ( orders [ i ] . AlreadyMade * 100 ) / orders [ i ] . Quantity ) ord . Status += " " ordersHTML = append ( ordersHTML , ord ) } return ordersHTML }
This method takes an array of WorkerOrder and returns an array of WorkerOrderHTML
so we can represent the information as human readable in the website.
This method takes an array of WorkerOrder and returns an array of WorkerOrderHTML so we can represent the information as human readable in the website .
//Here adds the Date //Here adds the Product //Here adds the Worker //Here adds the Quantity //Here adds the status