-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #544 from instedd/template-selector
Template selector
- Loading branch information
Showing
12 changed files
with
202 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
(ns planwise.client.projects2.components.create | ||
(:require [re-frame.core :refer [subscribe dispatch] :as rf] | ||
[planwise.client.asdf :as asdf] | ||
[reagent.core :as r] | ||
[re-com.core :as rc] | ||
[planwise.client.components.common2 :as common2] | ||
[planwise.client.routes :as routes] | ||
[planwise.client.utils :as utils] | ||
[planwise.client.ui.common :as ui] | ||
[planwise.client.ui.rmwc :as m] | ||
[planwise.client.mapping :refer [static-image fullmap-region-geo]] | ||
[planwise.client.components.common :as common])) | ||
(def project-templates | ||
[{:description "Plan facilities based on ground access" | ||
:icon "directions_walk" | ||
:key "plan" | ||
:defaults {:name "ground"}} | ||
{:description "Plan diagonostic devices & sample referrals" | ||
:icon "call_split" | ||
:key "diagnosis" | ||
:defaults {:name "sample"}}]) | ||
|
||
(defn project-section-template-selector | ||
[] | ||
[ui/fixed-width (common2/nav-params) | ||
(let [templates (subscribe [:projects2/templates]) | ||
scratch-template (first (filter #(not (contains? % :description)) @templates)) | ||
sample-templates (filter #(contains? % :description) @templates)] | ||
(dispatch [:projects2/get-templates-list]) | ||
[:div.template-container | ||
(if (some? sample-templates) | ||
[:h2 "Start from a template"]) | ||
(if (some? sample-templates) | ||
[:div.row | ||
(map (fn [template] | ||
[:a.action {:key (:key template) :onClick #(dispatch [:projects2/new-project (:defaults template)])} | ||
[m/Icon {} (:icon template)] | ||
[:div (:description template)]]) | ||
sample-templates)]) | ||
[:hr] | ||
[:h2 "Start from scratch"] | ||
[:div.row | ||
[:a.action {:onClick #(dispatch [:projects2/new-project (:defaults scratch-template)])} | ||
[m/Icon {} "folder_open"] | ||
[:div "Follow a wizard through all available settings"]]]])]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
(ns planwise.configuration.templates) | ||
|
||
(defn templates-list | ||
[] | ||
[{:description "Plan facilities based on ground access" | ||
:icon "directions_walk" | ||
:key "plan" | ||
:defaults {:name "ground" | ||
:config {:coverage {:filter-options {:driving-time 90}} | ||
:demographics {:target 12 | ||
:unit-name "humans"} | ||
:actions {:budget 123123 | ||
:build [{:id "build-0" | ||
:capacity 123 | ||
:investment 456} | ||
{:id "build-1" | ||
:capacity 333 | ||
:investment 444}] | ||
:upgrade [{:id "upgrade-0" | ||
:capacity 123 | ||
:investment 456} | ||
{:id "upgrade-1" | ||
:capacity 333 | ||
:investment 444}]}} | ||
|
||
:source-set-id 2 | ||
:region-id 1 | ||
:provider-set-id 1}} | ||
{:description "Plan diagonostic devices & sample referrals" | ||
:icon "call_split" | ||
:key "diagnosis" | ||
:defaults {:name "sample" | ||
:config {:coverage {} | ||
:demographics {} | ||
:actions {}} | ||
|
||
:source-set-id nil | ||
:region-id nil | ||
:provider-set-id nil}} | ||
{:key "empty" | ||
:defaults {:name "" | ||
:config {:coverage {} | ||
:demographics {} | ||
:actions {}} | ||
|
||
:source-set-id nil | ||
:region-id nil | ||
:provider-set-id nil}}]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters