func (VS *Server) toViewCategories(c *gin.Context, categories []Category) []CategoryHTML {
	var categoryHTML []CategoryHTML
	var cat CategoryHTML
	for i := 0; i < len(categories); i++ {

		//Here adds the common fields
		cat.ID = categories[i].ID
		cat.Name = categories[i].Name
		cat.TimeChecking = string(categories[i].TimeChecking)
		cat.Type = VS.getCategoryTypeByID(c, categories[i].Type, "h_view", "toViewCategories", "cat.Type = VS.getCategoryTypeByID(").Name
		cat.Photo = "/local/categories/" + cat.Type + "/" + categories[i].Name + "/" + categories[i].Photo
		cat.TypeItem = string(categories[i].TypeOfItem)

		serviceTypes := VS.getAllServiceTypes(c, "h_view", "toViewCategories", "serviceTypes := VS.getAllServiceTypes")
		for _, s := range serviceTypes {
			if ContainsID(categories[i].ServicesAccess, s.ID) {
				cat.Services = append(cat.Services, "/local/services/"+s.Icon)
			}
		}

		// We add the object
		categoryHTML = append(categoryHTML, cat)
		// We empty the array for the next loop
		cat.Services = nil

	}
	return categoryHTML
}
// This method takes an array of Category and returns an array of CategoryHTML
// so we can represent the human readable information in the website as human readable
This method takes an array of Category and returns an array of CategoryHTML
so we can represent the human readable information in the website as human readable
// This method takes an array of Category and returns an array of CategoryHTML // so we can represent the human readable information in the website as human readable
func (VS *Server) toViewCategories(c *gin.Context, categories []Category) []CategoryHTML {
	var categoryHTML []CategoryHTML
	var cat CategoryHTML
	for i := 0; i < len(categories); i++ {
		cat.ID = categories[i].ID
		cat.Name = categories[i].Name
		cat.TimeChecking = string(categories[i].TimeChecking)
		cat.Type = VS.getCategoryTypeByID(c, categories[i].Type, "h_view", "toViewCategories", "cat.Type = VS.getCategoryTypeByID(").Name
		cat.Photo = "/local/categories/" + cat.Type + "/" + categories[i].Name + "/" + categories[i].Photo
		cat.TypeItem = string(categories[i].TypeOfItem)
		serviceTypes := VS.getAllServiceTypes(c, "h_view", "toViewCategories", "serviceTypes := VS.getAllServiceTypes")
		for _, s := range serviceTypes {
			if ContainsID(categories[i].ServicesAccess, s.ID) {
				cat.Services = append(cat.Services, "/local/services/"+s.Icon)
			}
		}
		categoryHTML = append(categoryHTML, cat)
		cat.Services = nil
	}
	return categoryHTML
}
func ( VS * Server ) toViewCategories ( c * gin . Context , categories [ ] Category ) [ ] CategoryHTML { var categoryHTML [ ] CategoryHTML var cat CategoryHTML for i := 0 ; i < len ( categories ) ; i ++ { cat . ID = categories [ i ] . ID cat . Name = categories [ i ] . Name cat . TimeChecking = string ( categories [ i ] . TimeChecking ) cat . Type = VS . getCategoryTypeByID ( c , categories [ i ] . Type , " " , " " , " " ) . Name cat . Photo = " " + cat . Type + " " + categories [ i ] . Name + " " + categories [ i ] . Photo cat . TypeItem = string ( categories [ i ] . TypeOfItem ) serviceTypes := VS . getAllServiceTypes ( c , " " , " " , " " ) for _ , s := range serviceTypes { if ContainsID ( categories [ i ] . ServicesAccess , s . ID ) { cat . Services = append ( cat . Services , " " + s . Icon ) } } categoryHTML = append ( categoryHTML , cat ) cat . Services = nil } return categoryHTML }
This method takes an array of Category and returns an array of CategoryHTML
so we can represent the human readable information in the website as human readable
This method takes an array of Category and returns an array of CategoryHTML so we can represent the human readable information in the website as human readable
//Here adds the common fields // We add the object // We empty the array for the next loop