123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728 |
- package modules
- import (
- "html"
- "io/ioutil"
- "os"
- "golang-fave/engine/assets"
- "golang-fave/engine/builder"
- "golang-fave/engine/consts"
- "golang-fave/engine/utils"
- "golang-fave/engine/wrapper"
- )
- func (this *Modules) RegisterModule_Settings() *Module {
- return this.newModule(MInfo{
- Mount: "settings",
- Name: "Settings",
- Order: 801,
- System: true,
- Icon: assets.SysSvgIconGear,
- Sub: &[]MISub{
- {Mount: "default", Name: "General", Show: true, Icon: assets.SysSvgIconGear},
- {Mount: "robots-txt", Name: "Robots.txt", Show: true, Icon: assets.SysSvgIconBug},
- {Mount: "pagination", Name: "Pagination", Show: true, Icon: assets.SysSvgIconPagination},
- {Mount: "thumbnails", Name: "Thumbnails", Show: true, Icon: assets.SysSvgIconThumbnails},
- {Mount: "domains", Name: "Domains", Show: true, Icon: assets.SysSvgIconApi},
- {Mount: "smtp", Name: "SMTP", Show: true, Icon: assets.SysSvgIconEmail},
- {Mount: "shop", Name: "Shop", Show: true, Icon: assets.SysSvgIconShop},
- {Mount: "api", Name: "API", Show: true, Icon: assets.SysSvgIconApi},
- },
- }, nil, func(wrap *wrapper.Wrapper) (string, string, string) {
- content := ""
- sidebar := ""
- if wrap.CurrSubModule == "" || wrap.CurrSubModule == "default" {
- content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
- {Name: "General"},
- })
- content += builder.DataForm(wrap, []builder.DataFormField{
- {
- Kind: builder.DFKHidden,
- Name: "action",
- Value: "settings-general",
- },
- {
- Kind: builder.DFKText,
- CallBack: func(field *builder.DataFormField) string {
- modules_list := ``
- modules_list += `<select class="form-control" id="lbl_module-at-home" name="module-at-home">`
- modules_list += `<option value="0"`
- if (*wrap.Config).Engine.MainModule == 0 {
- modules_list += ` selected`
- }
- modules_list += `>Pages</option>`
- modules_list += `<option value="1"`
- if (*wrap.Config).Engine.MainModule == 1 {
- modules_list += ` selected`
- }
- modules_list += `>Blog</option>`
- modules_list += `<option value="2"`
- if (*wrap.Config).Engine.MainModule == 2 {
- modules_list += ` selected`
- }
- modules_list += `>Shop</option>`
- modules_list += `</select>`
- return `<div class="form-group n3">` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<label for="lbl_module-at-home">Module at home page</label>` +
- `</div>` +
- `<div class="col-md-9">` +
- `<div>` +
- modules_list +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>`
- },
- },
- {
- Kind: builder.DFKCheckBox,
- Caption: "Maintenance",
- Name: "maintenance",
- Value: utils.IntToStr((*wrap.Config).Engine.Maintenance),
- Hint: "Close web site for maintenance",
- },
- {
- Kind: builder.DFKCheckBox,
- Caption: "Blog is enabled",
- Name: "mod-enabled-blog",
- Value: utils.IntToStr((*wrap.Config).Modules.Enabled.Blog),
- Hint: "Module can be enabled or fully disabled",
- },
- {
- Kind: builder.DFKCheckBox,
- Caption: "Shop is enabled",
- Name: "mod-enabled-shop",
- Value: utils.IntToStr((*wrap.Config).Modules.Enabled.Shop),
- Hint: "Module can be enabled or fully disabled",
- },
- {
- Kind: builder.DFKSubmit,
- Value: "Save",
- Target: "add-edit-button",
- },
- })
- sidebar += `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Save</button>`
- } else if wrap.CurrSubModule == "robots-txt" {
- content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
- {Name: "Robots.txt"},
- })
- fcont := []byte(``)
- fcont, _ = ioutil.ReadFile(wrap.DTemplate + string(os.PathSeparator) + "robots.txt")
- content += builder.DataForm(wrap, []builder.DataFormField{
- {
- Kind: builder.DFKHidden,
- Name: "action",
- Value: "settings-robots-txt",
- },
- {
- Kind: builder.DFKText,
- CallBack: func(field *builder.DataFormField) string {
- return `<div class="form-group last"><div class="row"><div class="col-12"><textarea class="form-control autosize" id="lbl_content" name="content" placeholder="" autocomplete="off">` + html.EscapeString(string(fcont)) + `</textarea></div></div></div>`
- },
- },
- {
- Kind: builder.DFKSubmit,
- CallBack: func(field *builder.DataFormField) string {
- return `<div class="row d-lg-none"><div class="col-12"><div class="pt-3"><button type="submit" class="btn btn-primary" data-target="add-edit-button">Save</button></div></div></div>`
- },
- },
- })
- sidebar += `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Save</button>`
- } else if wrap.CurrSubModule == "pagination" {
- content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
- {Name: "Pagination"},
- })
- content += builder.DataForm(wrap, []builder.DataFormField{
- {
- Kind: builder.DFKHidden,
- Name: "action",
- Value: "settings-pagination",
- },
- {
- Kind: builder.DFKNumber,
- Caption: "Blog main page",
- Name: "blog-index",
- Min: "1",
- Max: "100",
- Required: true,
- Value: utils.IntToStr((*wrap.Config).Blog.Pagination.Index),
- },
- {
- Kind: builder.DFKNumber,
- Caption: "Blog category page",
- Name: "blog-category",
- Min: "1",
- Max: "100",
- Required: true,
- Value: utils.IntToStr((*wrap.Config).Blog.Pagination.Category),
- },
- {
- Kind: builder.DFKText,
- Caption: "",
- Name: "",
- Value: "",
- CallBack: func(field *builder.DataFormField) string {
- return `<hr>`
- },
- },
- {
- Kind: builder.DFKNumber,
- Caption: "Shop main page",
- Name: "shop-index",
- Min: "1",
- Max: "100",
- Required: true,
- Value: utils.IntToStr((*wrap.Config).Shop.Pagination.Index),
- },
- {
- Kind: builder.DFKNumber,
- Caption: "Shop category page",
- Name: "shop-category",
- Min: "1",
- Max: "100",
- Required: true,
- Value: utils.IntToStr((*wrap.Config).Shop.Pagination.Category),
- },
- {
- Kind: builder.DFKSubmit,
- Value: "Save",
- Target: "add-edit-button",
- },
- })
- sidebar += `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Save</button>`
- } else if wrap.CurrSubModule == "thumbnails" {
- content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
- {Name: "Thumbnails"},
- })
- content += builder.DataForm(wrap, []builder.DataFormField{
- {
- Kind: builder.DFKHidden,
- Name: "action",
- Value: "settings-thumbnails",
- },
- {
- Kind: builder.DFKText,
- CallBack: func(field *builder.DataFormField) string {
- resize_list := ``
- resize_list += `<select class="form-control" name="shop-thumbnail-r-1">`
- resize_list += `<option value="0"`
- if (*wrap.Config).Shop.Thumbnails.Thumbnail1[2] == 0 {
- resize_list += ` selected`
- }
- resize_list += `>Crop</option>`
- resize_list += `<option value="1"`
- if (*wrap.Config).Shop.Thumbnails.Thumbnail1[2] == 1 {
- resize_list += ` selected`
- }
- resize_list += `>Resize</option>`
- resize_list += `<option value="2"`
- if (*wrap.Config).Shop.Thumbnails.Thumbnail1[2] == 2 {
- resize_list += ` selected`
- }
- resize_list += `>Fit into size</option>`
- resize_list += `</select>`
- return `<div class="form-group n3">` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<label>Shop thumbnail 1</label>` +
- `</div>` +
- `<div class="col-md-9">` +
- `<div>` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<div><input class="form-control" type="number" name="shop-thumbnail-w-1" value="` + utils.IntToStr((*wrap.Config).Shop.Thumbnails.Thumbnail1[0]) + `" min="100" max="1000" placeholder="" autocomplete="off" required></div>` +
- `<div class="d-md-none mb-3"></div>` +
- `</div>` +
- `<div class="col-md-3">` +
- `<div><input class="form-control" type="number" name="shop-thumbnail-h-1" value="` + utils.IntToStr((*wrap.Config).Shop.Thumbnails.Thumbnail1[1]) + `" min="100" max="1000" placeholder="" autocomplete="off" required></div>` +
- `<div class="d-md-none mb-3"></div>` +
- `</div>` +
- `<div class="col-md-6">` +
- resize_list +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>`
- },
- },
- {
- Kind: builder.DFKText,
- CallBack: func(field *builder.DataFormField) string {
- resize_list := ``
- resize_list += `<select class="form-control" name="shop-thumbnail-r-2">`
- resize_list += `<option value="0"`
- if (*wrap.Config).Shop.Thumbnails.Thumbnail2[2] == 0 {
- resize_list += ` selected`
- }
- resize_list += `>Crop</option>`
- resize_list += `<option value="1"`
- if (*wrap.Config).Shop.Thumbnails.Thumbnail2[2] == 1 {
- resize_list += ` selected`
- }
- resize_list += `>Resize</option>`
- resize_list += `<option value="2"`
- if (*wrap.Config).Shop.Thumbnails.Thumbnail2[2] == 2 {
- resize_list += ` selected`
- }
- resize_list += `>Fit into size</option>`
- resize_list += `</select>`
- return `<div class="form-group n3">` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<label>Shop thumbnail 2</label>` +
- `</div>` +
- `<div class="col-md-9">` +
- `<div>` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<div><input class="form-control" type="number" name="shop-thumbnail-w-2" value="` + utils.IntToStr((*wrap.Config).Shop.Thumbnails.Thumbnail2[0]) + `" min="100" max="1000" placeholder="" autocomplete="off" required></div>` +
- `<div class="d-md-none mb-3"></div>` +
- `</div>` +
- `<div class="col-md-3">` +
- `<div><input class="form-control" type="number" name="shop-thumbnail-h-2" value="` + utils.IntToStr((*wrap.Config).Shop.Thumbnails.Thumbnail2[1]) + `" min="100" max="1000" placeholder="" autocomplete="off" required></div>` +
- `<div class="d-md-none mb-3"></div>` +
- `</div>` +
- `<div class="col-md-6">` +
- resize_list +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>`
- },
- },
- {
- Kind: builder.DFKText,
- CallBack: func(field *builder.DataFormField) string {
- resize_list := ``
- resize_list += `<select class="form-control" name="shop-thumbnail-r-3">`
- resize_list += `<option value="0"`
- if (*wrap.Config).Shop.Thumbnails.Thumbnail3[2] == 0 {
- resize_list += ` selected`
- }
- resize_list += `>Crop</option>`
- resize_list += `<option value="1"`
- if (*wrap.Config).Shop.Thumbnails.Thumbnail3[2] == 1 {
- resize_list += ` selected`
- }
- resize_list += `>Resize</option>`
- resize_list += `<option value="2"`
- if (*wrap.Config).Shop.Thumbnails.Thumbnail3[2] == 2 {
- resize_list += ` selected`
- }
- resize_list += `>Fit into size</option>`
- resize_list += `</select>`
- return `<div class="form-group n3">` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<label>Shop thumbnail 3</label>` +
- `</div>` +
- `<div class="col-md-9">` +
- `<div>` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<div><input class="form-control" type="number" name="shop-thumbnail-w-3" value="` + utils.IntToStr((*wrap.Config).Shop.Thumbnails.Thumbnail3[0]) + `" min="100" max="1000" placeholder="" autocomplete="off" required></div>` +
- `<div class="d-md-none mb-3"></div>` +
- `</div>` +
- `<div class="col-md-3">` +
- `<div><input class="form-control" type="number" name="shop-thumbnail-h-3" value="` + utils.IntToStr((*wrap.Config).Shop.Thumbnails.Thumbnail3[1]) + `" min="100" max="1000" placeholder="" autocomplete="off" required></div>` +
- `<div class="d-md-none mb-3"></div>` +
- `</div>` +
- `<div class="col-md-6">` +
- resize_list +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>`
- },
- },
- {
- Kind: builder.DFKText,
- CallBack: func(field *builder.DataFormField) string {
- resize_list := ``
- resize_list += `<select class="form-control" name="shop-thumbnail-r-full">`
- resize_list += `<option value="0"`
- if (*wrap.Config).Shop.Thumbnails.ThumbnailFull[2] == 0 {
- resize_list += ` selected`
- }
- resize_list += `>Crop</option>`
- resize_list += `<option value="1"`
- if (*wrap.Config).Shop.Thumbnails.ThumbnailFull[2] == 1 {
- resize_list += ` selected`
- }
- resize_list += `>Resize</option>`
- resize_list += `<option value="2"`
- if (*wrap.Config).Shop.Thumbnails.ThumbnailFull[2] == 2 {
- resize_list += ` selected`
- }
- resize_list += `>Fit into size</option>`
- resize_list += `</select>`
- return `<div class="form-group n3">` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<label>Shop thumbnail full</label>` +
- `</div>` +
- `<div class="col-md-9">` +
- `<div>` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<div><input class="form-control" type="number" name="shop-thumbnail-w-full" value="` + utils.IntToStr((*wrap.Config).Shop.Thumbnails.ThumbnailFull[0]) + `" min="100" max="1000" placeholder="" autocomplete="off" required></div>` +
- `<div class="d-md-none mb-3"></div>` +
- `</div>` +
- `<div class="col-md-3">` +
- `<div><input class="form-control" type="number" name="shop-thumbnail-h-full" value="` + utils.IntToStr((*wrap.Config).Shop.Thumbnails.ThumbnailFull[1]) + `" min="100" max="1000" placeholder="" autocomplete="off" required></div>` +
- `<div class="d-md-none mb-3"></div>` +
- `</div>` +
- `<div class="col-md-6">` +
- resize_list +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>`
- },
- },
- {
- Kind: builder.DFKSubmit,
- Value: "Save",
- Target: "add-edit-button",
- },
- })
- sidebar += `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Save</button>`
- } else if wrap.CurrSubModule == "domains" {
- content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
- {Name: "Domains"},
- })
- fcont := []byte(``)
- fcont, _ = ioutil.ReadFile(wrap.DConfig + string(os.PathSeparator) + ".domains")
- content += builder.DataForm(wrap, []builder.DataFormField{
- {
- Kind: builder.DFKHidden,
- Name: "action",
- Value: "settings-domains",
- },
- {
- Kind: builder.DFKText,
- CallBack: func(field *builder.DataFormField) string {
- return `<div class="form-group last"><div class="row"><div class="col-12"><textarea class="form-control autosize" id="lbl_content" name="content" placeholder="" autocomplete="off">` + html.EscapeString(string(fcont)) + `</textarea></div></div></div>`
- },
- },
- {
- Kind: builder.DFKSubmit,
- CallBack: func(field *builder.DataFormField) string {
- return `<div class="row d-lg-none"><div class="col-12"><div class="pt-3"><button type="submit" class="btn btn-primary" data-target="add-edit-button">Save</button></div></div></div>`
- },
- },
- })
- sidebar += `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Save</button>`
- } else if wrap.CurrSubModule == "smtp" {
- content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
- {Name: "SMTP"},
- })
- content += builder.DataForm(wrap, []builder.DataFormField{
- {
- Kind: builder.DFKHidden,
- Name: "action",
- Value: "settings-smtp",
- },
- {
- Kind: builder.DFKText,
- Caption: "SMTP server host",
- Name: "smtp-host",
- Value: (*wrap.Config).SMTP.Host,
- Hint: "Example: smtp.gmail.com",
- },
- {
- Kind: builder.DFKNumber,
- Caption: "SMTP server port",
- Name: "smtp-port",
- Min: "0",
- Max: "9999",
- Required: true,
- Value: utils.IntToStr((*wrap.Config).SMTP.Port),
- Hint: "Example: 587",
- },
- {
- Kind: builder.DFKText,
- Caption: "SMTP user login",
- Name: "smtp-login",
- Value: (*wrap.Config).SMTP.Login,
- Hint: "Example: example@gmail.com",
- },
- {
- Kind: builder.DFKPassword,
- Caption: "SMTP user password",
- Name: "smtp-password",
- Value: "",
- Hint: "Leave this field empty if you don't want change password",
- },
- {
- Kind: builder.DFKText,
- Caption: "Email address for testing",
- Name: "smtp-test-email",
- Value: "",
- Hint: "To this email address will be send test email message if settings are correct",
- },
- {
- Kind: builder.DFKSubmit,
- Value: "Save",
- Target: "add-edit-button",
- },
- })
- sidebar += `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Save</button>`
- } else if wrap.CurrSubModule == "shop" {
- content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
- {Name: "Shop"},
- })
- content += builder.DataForm(wrap, []builder.DataFormField{
- {
- Kind: builder.DFKHidden,
- Name: "action",
- Value: "settings-shop",
- },
- {
- Kind: builder.DFKText,
- CallBack: func(field *builder.DataFormField) string {
- price_format_list := ``
- price_format_list += `<select class="form-control" id="lbl_price-fomat" name="price-fomat">`
- price_format_list += `<option value="0"`
- if (*wrap.Config).Shop.Price.Format == 0 {
- price_format_list += ` selected`
- }
- price_format_list += `>100</option>`
- price_format_list += `<option value="1"`
- if (*wrap.Config).Shop.Price.Format == 1 {
- price_format_list += ` selected`
- }
- price_format_list += `>100.0</option>`
- price_format_list += `<option value="2"`
- if (*wrap.Config).Shop.Price.Format == 2 {
- price_format_list += ` selected`
- }
- price_format_list += `>100.00</option>`
- price_format_list += `<option value="3"`
- if (*wrap.Config).Shop.Price.Format == 3 {
- price_format_list += ` selected`
- }
- price_format_list += `>100.000</option>`
- price_format_list += `<option value="4"`
- if (*wrap.Config).Shop.Price.Format == 4 {
- price_format_list += ` selected`
- }
- price_format_list += `>100.0000</option>`
- price_format_list += `</select>`
- price_round_list := ``
- price_round_list += `<select class="form-control" id="lbl_price-round" name="price-round">`
- price_round_list += `<option value="0"`
- if (*wrap.Config).Shop.Price.Round == 0 {
- price_round_list += ` selected`
- }
- price_round_list += `>Don't round</option>`
- price_round_list += `<option value="1"`
- if (*wrap.Config).Shop.Price.Round == 1 {
- price_round_list += ` selected`
- }
- price_round_list += `>Round to ceil</option>`
- price_round_list += `<option value="2"`
- if (*wrap.Config).Shop.Price.Round == 2 {
- price_round_list += ` selected`
- }
- price_round_list += `>Round to floor</option>`
- price_round_list += `</select>`
- return `<div class="form-group n2">` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<label for="lbl_price-fomat">Price format</label>` +
- `</div>` +
- `<div class="col-md-9">` +
- `<div>` +
- price_format_list +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>` +
- `<div class="form-group n3">` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<label for="lbl_price-round">Price round</label>` +
- `</div>` +
- `<div class="col-md-9">` +
- `<div>` +
- price_round_list +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>`
- },
- },
- {
- Kind: builder.DFKText,
- CallBack: func(field *builder.DataFormField) string {
- make_checkbox := func(name, caption string, value int) string {
- checked := ""
- if value > 0 {
- checked = " checked"
- }
- return `<div class="checkbox-clickable"><input class="form-control" type="checkbox" id="lbl_` +
- name + `" name="` + name + `" value="1" "="" autocomplete="off"` + checked +
- `><label for="lbl_` + name + `">` + caption + `</label></div>`
- }
- checkboxes := ""
- checkboxes += make_checkbox("require-last-name", "Last Name", (*wrap.Config).Shop.Orders.RequiredFields.LastName)
- checkboxes += make_checkbox("require-first-name", "First Name", (*wrap.Config).Shop.Orders.RequiredFields.FirstName)
- checkboxes += make_checkbox("require-middle-name", "Middle Name", (*wrap.Config).Shop.Orders.RequiredFields.MiddleName)
- checkboxes += make_checkbox("require-mobile-phone", "Mobile Phone", (*wrap.Config).Shop.Orders.RequiredFields.MobilePhone)
- checkboxes += make_checkbox("require-email-address", "Email Address", (*wrap.Config).Shop.Orders.RequiredFields.EmailAddress)
- checkboxes += make_checkbox("require-delivery", "Delivery", (*wrap.Config).Shop.Orders.RequiredFields.Delivery)
- checkboxes += make_checkbox("require-comment", "Comment", (*wrap.Config).Shop.Orders.RequiredFields.Comment)
- return `<div class="form-group n4">` +
- `<div class="row">` +
- `<div class="col-md-3">` +
- `<label for="lbl_price-fomat">Order require fields</label>` +
- `</div>` +
- `<div class="col-md-9">` +
- `<div>` +
- checkboxes +
- `</div>` +
- `</div>` +
- `</div>` +
- `</div>`
- },
- },
- {
- Kind: builder.DFKCheckBox,
- Caption: "Accept orders",
- Name: "accept-orders",
- Value: utils.IntToStr((*wrap.Config).Shop.Orders.Enabled),
- },
- {
- Kind: builder.DFKText,
- Caption: "New order notify email",
- Name: "new-order-notify-email",
- Value: (*wrap.Config).Shop.Orders.NotifyEmail,
- Hint: "Example: example@gmail.com",
- },
- {
- Kind: builder.DFKText,
- Caption: "New order email theme (CP)",
- Name: "new-order-email-theme-cp",
- Value: (*wrap.Config).Shop.Orders.NewOrderEmailThemeCp,
- },
- {
- Kind: builder.DFKText,
- Caption: "New order email theme (User)",
- Name: "new-order-email-theme-user",
- Value: (*wrap.Config).Shop.Orders.NewOrderEmailThemeUser,
- },
- {
- Kind: builder.DFKCheckBox,
- Caption: "Custom field 1 enabled",
- Name: "custom-field-1-enabled",
- Value: utils.IntToStr((*wrap.Config).Shop.CustomFields.Field1.Enabled),
- },
- {
- Kind: builder.DFKText,
- Caption: "Custom field 1 caption",
- Name: "custom-field-1-caption",
- Value: (*wrap.Config).Shop.CustomFields.Field1.Caption,
- Hint: "Caption for product custom field",
- },
- {
- Kind: builder.DFKCheckBox,
- Caption: "Custom field 2 enabled",
- Name: "custom-field-2-enabled",
- Value: utils.IntToStr((*wrap.Config).Shop.CustomFields.Field2.Enabled),
- },
- {
- Kind: builder.DFKText,
- Caption: "Custom field 2 caption",
- Name: "custom-field-2-caption",
- Value: (*wrap.Config).Shop.CustomFields.Field2.Caption,
- Hint: "Caption for product custom field",
- },
- {
- Kind: builder.DFKSubmit,
- Value: "Save",
- Target: "add-edit-button",
- },
- })
- sidebar += `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Save</button>`
- } else if wrap.CurrSubModule == "api" {
- content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
- {Name: "API"},
- })
- content += builder.DataForm(wrap, []builder.DataFormField{
- {
- Kind: builder.DFKHidden,
- Name: "action",
- Value: "settings-api",
- },
- {
- Kind: builder.DFKCheckBox,
- Caption: "XML enabled",
- Name: "xml-enabled",
- Value: utils.IntToStr((*wrap.Config).API.XML.Enabled),
- Hint: "XML: <a href=\"/api/products/\" target=\"_blank\">/api/products/</a>",
- },
- {
- Kind: builder.DFKText,
- Caption: "XML name",
- Name: "xml-name",
- Value: (*wrap.Config).API.XML.Name,
- },
- {
- Kind: builder.DFKText,
- Caption: "XML company",
- Name: "xml-company",
- Value: (*wrap.Config).API.XML.Company,
- },
- {
- Kind: builder.DFKText,
- Caption: "XML url",
- Name: "xml-url",
- Value: (*wrap.Config).API.XML.Url,
- },
- {
- Kind: builder.DFKSubmit,
- Value: "Save",
- Target: "add-edit-button",
- },
- })
- sidebar += `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Save</button>`
- }
- return this.getSidebarModules(wrap), content, sidebar
- })
- }
|