Freelancer Template base Managment page

This commit is contained in:
Tina_Azure
2023-05-12 00:03:25 +02:00
parent b0b8dd5ec0
commit ed370e7979
5 changed files with 116 additions and 10 deletions

View File

@ -625,7 +625,7 @@ int main(int argc, char *argv[]) {
});
/*
* Page for freelancer to sign up
* Freelancer Profile page
*/
CROW_ROUTE(app, "/freelancer/profile")
([&, configuration](const crow::request& getRequest ) {
@ -638,6 +638,46 @@ int main(int argc, char *argv[]) {
return page.render(ctx);
});
/*
* Page for freelancer to create/delete/edit Templates
*/
CROW_ROUTE(app, "/freelancer/templateManagement")
([&, configuration](const crow::request& getRequest ) {
auto& cookieCtx = app.get_context<crow::CookieParser>(getRequest);
crow::mustache::context ctx;
string templateHTML = TEMPLATE_FREELANCER_TEMPLATE_MANAGEMENT;
if (Utilities::checkCookieLoginState(configuration, cookieCtx)) {
ctx = Utilities::getFreelancerTemplates(configuration, cookieCtx.get_cookie(COOKIE_FREELANCER_EMAIL));
ctx[MUSTACHE_COOKIE_LOGGED_IN] = true;
}
auto page = crow::mustache::load(templateHTML);
return page.render(ctx);
});
/*
* Page for freelancer to create/delete/edit Templates
*/
CROW_ROUTE(app, "/freelancer/templateManagement/template/<string>").methods("POST"_method)
([&, configuration](const crow::request& getRequest, string templateName ) {
auto& cookieCtx = app.get_context<crow::CookieParser>(getRequest);
crow::mustache::context ctx;
string templateHTML = TEMPLATE_FREELANCER_TEMPLATE_MANAGEMENT;
if (Utilities::checkCookieLoginState(configuration, cookieCtx))
ctx[MUSTACHE_COOKIE_LOGGED_IN] = true;
auto page = crow::mustache::load(templateHTML);
return page.render(ctx);
});