Subversion Repositories SmartDukaan

Rev

Rev 36811 | Rev 36821 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36811 Rev 36814
Line 1994... Line 1994...
1994
		result.put("isDefault", loc.isDefault());
1994
		result.put("isDefault", loc.isDefault());
1995
		result.put("message", makeDefault ? "Base location added and set as default" : "Base location added");
1995
		result.put("message", makeDefault ? "Base location added and set as default" : "Base location added");
1996
		return responseSender.ok(result);
1996
		return responseSender.ok(result);
1997
	}
1997
	}
1998
 
1998
 
-
 
1999
	// Read-only list of company offices — gives BMs a quick lookup of the codes
-
 
2000
	// they'll need to drop into the bulk-upload sheet for OFFICE stops.
-
 
2001
	// Two URL mappings: /companyOffice/list (canonical) + /company-office-list
-
 
2002
	// (matches the menu's action_class so the sidebar link works without an extra
-
 
2003
	// auth.menu update).
-
 
2004
	@GetMapping(value = {"/companyOffice/list", "/company-office-list"})
-
 
2005
	public String companyOfficeList(Model model) {
-
 
2006
		List<com.spice.profitmandi.dao.entity.logistics.CompanyOffice> offices = companyOfficeRepository.selectAll();
-
 
2007
		// Active first, then sort by code so the bulk-upload reference is stable across page loads.
-
 
2008
		offices.sort((a, b) -> {
-
 
2009
			int aa = a.isActive() ? 0 : 1;
-
 
2010
			int bb = b.isActive() ? 0 : 1;
-
 
2011
			if (aa != bb) return Integer.compare(aa, bb);
-
 
2012
			String ac = a.getCode() != null ? a.getCode() : "";
-
 
2013
			String bc = b.getCode() != null ? b.getCode() : "";
-
 
2014
			return ac.compareToIgnoreCase(bc);
-
 
2015
		});
-
 
2016
		model.addAttribute("offices", offices);
-
 
2017
		return "company-office-list";
-
 
2018
	}
-
 
2019
 
1999
	@GetMapping(value = "/beatPlan/downloadTemplate")
2020
	@GetMapping(value = "/beatPlan/downloadTemplate")
2000
	public ResponseEntity<?> downloadTemplate() throws java.io.IOException {
2021
	public ResponseEntity<?> downloadTemplate() throws java.io.IOException {
2001
		org.apache.poi.xssf.usermodel.XSSFWorkbook wb = new org.apache.poi.xssf.usermodel.XSSFWorkbook();
2022
		org.apache.poi.xssf.usermodel.XSSFWorkbook wb = new org.apache.poi.xssf.usermodel.XSSFWorkbook();
2002
		org.apache.poi.xssf.usermodel.XSSFSheet sheet = wb.createSheet("beat-plan");
2023
		org.apache.poi.xssf.usermodel.XSSFSheet sheet = wb.createSheet("beat-plan");
2003
 
2024