<?php
$graph = $this->getParam('graph', false);
$usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
?>

<div class="cover margin-bottom-small">
    <div class="zone xxl margin-bottom-xl margin-top-small">
        <h1 class="margin-bottom-small"
            data-service="projects.get"
            data-event="load,project.update,projects.createPlatform,projects.updatePlatform,projects.deletePlatform"
            data-name="console-project"
            data-param-project-id="{{router.params.project}}"
            data-scope="console">
            <span class="title" data-ls-bind="{{console-project.name}}">&nbsp;</span>&nbsp;&nbsp;
        </h1>

        <ul class="desktops-only margin-top-negative-small margin-bottom clear">
            <li class="pull-start margin-end margin-bottom-small"><a data-ls-attrs="href=/console/settings?project={{router.params.project}}" class="link-animation-enabled"><i class="icon-cog"></i> &nbsp;Settings</a> &nbsp;&nbsp;</li>
            <li class="pull-start margin-end margin-bottom-small"><a data-ls-attrs="href=/console/keys?project={{router.params.project}}" class="link-animation-enabled"><i class="icon-key-inv"></i> &nbsp;API Keys</a> &nbsp;&nbsp;</li>
            <li class="pull-start margin-end margin-bottom-small"><a data-ls-attrs="href=/console/webhooks?project={{router.params.project}}" class="link-animation-enabled"><i class="icon-link"></i> &nbsp;Webhooks</a> &nbsp;&nbsp;</li>
        </ul>

        <div class="margin-bottom phones-only">&nbsp;</div>
    </div>
</div>

<div class="zone xxl margin-top-negative-xxxl">
    <div class="clear margin-bottom-small margin-top-negative">
        <?php if (!$graph && $usageStatsEnabled): ?>
            <div class="pull-end">

                <form class="margin-start-small inline" data-ls-if="{{usage.range}} !== '24h'"
                    data-analytics
                    data-analytics-event="click"
                    data-analytics-category="console"
                    data-analytics-label="Usage 24h"
                    data-service="projects.getUsage"
                    data-event="submit"
                    data-scope="console"
                    data-name="usage"
                    data-param-project-id="{{router.params.project}}"
                    data-param-range="24h"
                    data-scope="console">
                    <button class="tick">24h</button>
                </form>

                <button class="tick margin-start-small" data-ls-if="{{usage.range}} === '24h'" disabled>24h</button>

                <form class="margin-start-small inline" data-ls-if="{{usage.range}} !== '30d'"
                    data-analytics
                    data-analytics-event="click"
                    data-analytics-category="console"
                    data-analytics-label="Usage 30d"
                    data-service="projects.getUsage"
                    data-event="submit"
                    data-scope="console"
                    data-name="usage"
                    data-param-project-id="{{router.params.project}}"
                    data-scope="console">
                    <button class="tick">30d</button>
                </form>

                <button class="tick margin-start-small" data-ls-if="{{usage.range}} === '30d'" disabled>30d</button>

                <form class="margin-start-small inline" data-ls-if="{{usage.range}} !== '90d'"
                    data-analytics
                    data-analytics-event="click"
                    data-analytics-category="console"
                    data-analytics-label="Usage 90d"
                    data-service="projects.getUsage"
                    data-event="submit"
                    data-scope="console"
                    data-name="usage"
                    data-param-project-id="{{router.params.project}}"
                    data-param-range="90d"
                    data-scope="console">
                    <button class="tick">90d</button>
                </form>

                <button class="tick margin-start-small" data-ls-if="{{usage.range}} === '90d'" disabled>90d</button>
            </div>
        <?php endif;?>
    </div>
    <div
        data-service="projects.getUsage"
        data-event="load"
        data-scope="console"
        data-name="usage"
        data-param-project-id="{{router.params.project}}"
        data-param-range="30d">
            <?php if (!$graph && $usageStatsEnabled): ?>
            <div class="box dashboard">
                <div class="row responsive">
                    <div class="col span-9">
                        <div class="chart pull-end">
                            <input type="hidden" data-ls-bind="{{usage}}" data-forms-chart="Requests=requests" />
                        </div>

                        <div class="chart-metric">
                            <div class="value margin-bottom-small"><span class="sum" data-ls-bind="{{usage.requests|statsGetTotal|statsTotal}}">N/A</span></div>
                            <div class="unit margin-start-no margin-bottom-small">Requests</div>
                        </div>
                    </div>
                    <div class="col span-3">
                        <div class="value margin-bottom-small">
                            <span class="sum" data-ls-bind="{{realtime.current|accessProject|statsTotal}}" data-default="0">0</span>
                        </div>
                        <div class="unit margin-start-no margin-bottom-small">Connections</div>
                        <div class="chart-bar margin-top-small margin-bottom-small" data-ls-attrs="data-history={{realtime.history|accessProject}}" data-forms-chart-bars="{{realtime.history|accessProject}}"></div>
                        <div class="text-fade-dark text-size-small">Activity last 60 seconds</div>
                    </div>
                </div>
            </div>
            <?php endif; ?>
            <div class="box dashboard">
                <div class="row responsive">
                    <div class="col span-3">
                        <div class="value"><span class="sum" data-ls-bind="{{usage.documents|statsGetLast|statsTotal}}" data-default="0">0</span></div>
                        <div class="margin-top-small"><b class="text-size-small unit">Documents</b></div>
                    </div>
                    <div class="col span-3">
                        <div class="value">
                            <span class="sum" data-ls-bind="{{usage.storage|statsGetLast|humanFileSize}}" data-default="0">0</span>
                            <span data-ls-bind="{{usage.storage|statsGetLast|humanFileUnit}}" class="text-size-small unit"></span>
                        </div>
                        <div class="margin-top-small"><b class="text-size-small unit">Storage</b></div>
                    </div>
                    <div class="col span-3">
                        <div class="value"><span class="sum" data-ls-bind="{{usage.users|statsGetLast|statsTotal}}" data-default="0">0</span></div>
                        <div class="margin-top-small"><b class="text-size-small unit">Users</b></div>
                    </div>
                    <div class="col span-3">
                        <div class="value"><span class="sum" data-ls-bind="{{usage.functions|statsGetLast|statsTotal}}" data-default="0">0</span></div>
                        <div class="margin-top-small"><b class="text-size-small unit">Executions</b></div>
                    </div>
                </div>
            </div>
        </div>

        <p class="margin-top-small text-size-small"><i class="icon-info-circled"></i> Data is aggregated and updated every 15 minutes</p>
    </div>
    </div>
</div>

<div class="zone xl margin-top-xl clear" data-ls-if="({{console-project}})">
    <h2 class="margin-bottom">Platforms</h2>

    <div class="box margin-bottom" data-ls-if="0 < {{console-project.platforms.length}} && undefined !== {{console-project.platforms}}">
        <ul data-ls-loop="console-project.platforms" data-ls-as="platform" class="list">
            <li class="clear">
                <div class="pull-end desktops-only">
                    <button data-ls-ui-trigger="platform-delete-{{platform.$id}}" class="reverse danger margin-end-small">Delete</button>
                    <button data-ls-ui-trigger="platform-update-{{platform.$id}}">Update</button>
                </div>


                <div data-ui-modal data-button-hide="on" data-open-event="platform-update-{{platform.$id}}">
                    <button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>

                    <h1>Update Platform</h1>

                    <div data-ls-template="template-{{platform.type}}-update" data-type="script"></div>
                </div>

                <form class="pull-end margin-end"
                    data-analytics
                    data-analytics-activity
                    data-analytics-event="submit"
                    data-analytics-category="console"
                    data-analytics-label="Delete Project Platform"
                    data-service="projects.deletePlatform"
                    data-scope="console"
                    data-event="platform-delete-{{platform.$id}}"
                    data-confirm="Are you sure you want to delete this platform?"
                    data-success="alert,trigger"
                    data-success-param-alert-text="Deleted platform successfully"
                    data-success-param-trigger-events="projects.deletePlatform"
                    data-failure="alert"
                    data-failure-param-alert-text="Failed to delete platform"
                    data-failure-param-alert-classname="error">
                    <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
                    <input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />
                </form>

                <div>
                    <div class="pull-start margin-end avatar-container">
                        <img src="" data-ls-attrs="src=/images/clients/{{platform.type}}.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Platform Logo" class="avatar" loading="lazy" width="60" height="60" />

                        <div data-ls-if="{{platform.type}} === 'flutter-ios'" class="corner">
                            <img src="" data-ls-attrs="src=/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="iOS Logo" class="avatar xs" loading="lazy" width="30" height="30" />
                        </div>

                        <div data-ls-if="{{platform.type}} === 'flutter-android'" class="corner">
                            <img src="" data-ls-attrs="src=/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Android Logo" class="avatar xs" loading="lazy" width="30" height="30" />
                        </div>

                        <div data-ls-if="{{platform.type}} === 'flutter-linux'" class="corner">
                            <img src="" data-ls-attrs="src=/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Linux Logo" class="avatar xs" loading="lazy" width="30" height="30" />
                        </div>

                        <div data-ls-if="{{platform.type}} === 'flutter-macos'" class="corner">
                            <img src="" data-ls-attrs="src=/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="MacOS Logo" class="avatar xs" loading="lazy" width="30" height="30" />
                        </div>

                        <div data-ls-if="{{platform.type}} === 'flutter-windows'" class="corner">
                            <img src="" data-ls-attrs="src=/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Windows Logo" class="avatar xs" loading="lazy" width="30" height="30" />
                        </div>

                        <div data-ls-if="{{platform.type}} === 'apple-ios'" class="corner">
                            <img src="" data-ls-attrs="src=/images/clients/apple.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="iOS Logo" class="avatar xs" loading="lazy" width="30" height="30" />
                        </div>

                        <div data-ls-if="{{platform.type}} === 'apple-macos'" class="corner">
                            <img src="" data-ls-attrs="src=/images/clients/apple.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="macOS Logo" class="avatar xs" loading="lazy" width="30" height="30" />
                        </div>

                        <div data-ls-if="{{platform.type}} === 'apple-watchos'" class="corner">
                            <img src="" data-ls-attrs="src=/images/clients/apple.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="watchOS Logo" class="avatar xs" loading="lazy" width="30" height="30" />
                        </div>

                        <div data-ls-if="{{platform.type}} === 'apple-tvos'" class="corner">
                            <img src="" data-ls-attrs="src=/images/clients/apple.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="tvOS Logo" class="avatar xs" loading="lazy" width="30" height="30" />
                        </div>
                    </div>
                    <span class="text-one-liner" data-ls-bind="{{platform.name}}"></span>
                </div>

                <p class="margin-bottom-no"><small data-ls-bind="{{platform.hostname}}{{platform.key}}"></small></p>

                <div class="phones-only-inline tablets-only-inline margin-top-small">
                    <button class="link" data-ls-ui-trigger="platform-update-{{platform.$id}}">Update</button>
                    <button class="link danger" data-ls-ui-trigger="platform-delete-{{platform.$id}}">Delete</button>
                </div>
            </li>
        </ul>
    </div>

    <div data-ls-if="(!{{console-project.platforms.length}})" class="box dashboard margin-bottom">
        <div class="margin-bottom-small margin-top-small margin-end margin-start">
            <h3 class="margin-bottom-small text-bold">No Platforms Added to Your Project</h3>

            <p class="margin-bottom-no">Add your first platform and build your new application.</p>
        </div>
    </div>

    <div class="pull-end desktops-only tablets-only">
        <a data-analytics
            data-analytics-event="click"
            data-analytics-category="console"
            data-analytics-label="API Keys Link"
            data-ls-attrs="href=/console/keys?project={{router.params.project}}">Manage Your Server API Keys</a>
    </div>

    <div class="drop-list pull-start" data-ls-ui-open="" data-button-aria="Choose Platform" data-button-text="Add Platform" data-button-class="button" data-blur="1">
        <ul>
            <li>
                <div class="link web-new"><img src="/images/clients/web.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Web Platform Logo" class="avatar xxs margin-end-small" loading="lazy" /> New Web App</div>
            </li>
            <li>
                <div class="link flutter-new"><img src="/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Flutter Platform Logo" class="avatar xxs margin-end-small" loading="lazy" /> New Flutter App</div>
            </li>
            <li>
                <div class="link apple-new"><img src="/images/clients/apple.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="iOS Platform Logo" class="avatar xxs margin-end-small" loading="lazy" /> New Apple App</div>
            </li>
            <li>
                <div class="link android-new"><img src="/images/clients/android.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Android Platform Logo" class="avatar xxs margin-end-small" loading="lazy" /> New Android App</div>
            </li>
            <li class="disabled">
                <div class="link unity-new"><img src="/images/clients/unity.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Unity Platform Logo" class="avatar xxs margin-end-small" loading="lazy" /> New Unity Game  <span class="text-fade text-size-small">(soon)</span></div>
            </li>
        </ul>
    </div>
</div>

<div data-ui-modal class="modal box close" data-button-alias=".web-new">
    <button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>

    <h1>New Web App</h1>

    <form
        data-analytics
        data-analytics-activity
        data-analytics-event="submit"
        data-analytics-category="console"
        data-analytics-label="Create Project Platform (Web)"
        data-service="projects.createPlatform"
        data-scope="console"
        data-event="submit"
        data-success="alert,trigger,reset"
        data-success-param-alert-text="Created new platform successfully"
        data-success-param-trigger-events="projects.createPlatform"
        data-failure="alert"
        data-failure-param-alert-text="Failed to create platform"
        data-failure-param-alert-classname="error">

        <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
        <input type="hidden" name="type" data-ls-bind="web" />

        <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
        <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My Web App" maxlength="128" />

        <label for="hostname">Hostname <span class="tooltip large" data-tooltip="The hostname that your website will use to interact with the <?php echo APP_NAME; ?> APIs in production or development environments. No port number required."><i class="icon-question"></i></span></label>
        <input name="hostname" type="text" class="margin-bottom" autocomplete="off" placeholder="localhost" required>

        <div class="info margin-top margin-bottom">
            <div class="text-bold margin-bottom-small">Next Steps</div>

            <p>After adding your new website, install our Web SDK to integrate with your code and read our <a data-ls-attrs="href={{env.HOME}}/docs/getting-started-for-web" target="_blank" rel="noopener">getting started</a> tutorial.</p>

            <div class="margin-bottom-no ide" data-lang="bash" data-lang-label="bash">
                <pre class="line-numbers"><code class="prism language-bash" data-prism>npm install appwrite</code></pre>
            </div>
        </div>

        <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
    </form>
</div>

<script type="text/html" id="template-web-update">
    <form
        data-analytics
        data-analytics-activity
        data-analytics-event="submit"
        data-analytics-category="console"
        data-analytics-label="Update Project Platform (Web)"
        data-service="projects.updatePlatform"
        data-scope="console"
        data-event="submit"
        data-success="alert,trigger"
        data-success-param-alert-text="Updated platform successfully"
        data-success-param-trigger-events="projects.updatePlatform"
        data-failure="alert"
        data-failure-param-alert-text="Failed to update platform"
        data-failure-param-alert-classname="error">

        <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
        <input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />

        <label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
        <input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My Web App" maxlength="128" />

        <label for="hostname">Hostname <span class="tooltip large" data-tooltip="The hostname that your website will use to interact with the <?php echo APP_NAME; ?> APIs in production or development environments. No port number required."><i class="icon-question"></i></span></label>
        <input name="hostname" type="text" class="margin-bottom" autocomplete="off" placeholder="localhost" data-ls-bind="{{platform.hostname}}" required />

        <hr />

        <button type="submit">Update</button> &nbsp; <button data-ls-ui-trigger="modal-close" type="button" class="reverse">Cancel</button>
    </form>
</script>

<div data-ui-modal class="modal box close" data-button-alias=".android-new">
    <button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>

    <h1>Register your Android App</h1>

    <form
        data-analytics
        data-analytics-activity
        data-analytics-event="submit"
        data-analytics-category="console"
        data-analytics-label="Create Project Platform (Android)"
        data-service="projects.createPlatform"
        data-scope="console"
        data-event="submit"
        data-success="alert,trigger,reset"
        data-success-param-alert-text="Registered new platform successfully"
        data-success-param-trigger-events="projects.createPlatform"
        data-failure="alert"
        data-failure-param-alert-text="Failed to register platform"
        data-failure-param-alert-classname="error">

        <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
        <input type="hidden" name="type" data-ls-bind="android" />

        <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
        <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My Android App" maxlength="128" />

        <label for="key">Package Name <span class="tooltip large" data-tooltip="Your package name is generally the applicationId in your app-level build.gradle file."><i class="icon-question"></i></span></label>
        <input type="text" class="full-width" name="key" required autocomplete="off" placeholder="com.company.appname" />

        <hr />

        <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
    </form>
</div>

<div data-ui-modal class="modal box close width-large" data-button-alias=".flutter-new">
    <button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>

    <h1 class="margin-bottom-xl">Register your Flutter App</h1>

    <ul class="phases clear margin-top-negative-small padding" data-ui-phases>
        <li>
            <h2 style="display: none">&nbsp;&nbsp;iOS&nbsp;&nbsp;</h2>

            <form
                data-analytics
                data-analytics-activity
                data-analytics-event="submit"
                data-analytics-category="console"
                data-analytics-label="Create Project Platform (Flutter / iOS)"
                data-service="projects.createPlatform"
                data-scope="console"
                data-event="submit"
                data-success="alert,trigger,reset"
                data-success-param-alert-text="Registered new platform successfully"
                data-success-param-trigger-events="projects.createPlatform"
                data-failure="alert"
                data-failure-param-alert-text="Failed to register platform"
                data-failure-param-alert-classname="error">

                <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
                <input type="hidden" name="type" data-ls-bind="flutter-ios" />

                <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My iOS App" maxlength="128" />

                <label for="key">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="key" required autocomplete="off" placeholder="com.company.appname" />

                <hr />

                <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
            </form>

        </li>
        <li>
            <h2 style="display: none">&nbsp;&nbsp;Android&nbsp;&nbsp;</h2>

            <form
                data-analytics
                data-analytics-activity
                data-analytics-event="submit"
                data-analytics-category="console"
                data-analytics-label="Create Project Platform (Flutter / Android)"
                data-service="projects.createPlatform"
                data-scope="console"
                data-event="submit"
                data-success="alert,trigger,reset"
                data-success-param-alert-text="Registered new platform successfully"
                data-success-param-trigger-events="projects.createPlatform"
                data-failure="alert"
                data-failure-param-alert-text="Failed to register platform"
                data-failure-param-alert-classname="error">

                <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
                <input type="hidden" name="type" data-ls-bind="flutter-android" />

                <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My Android App" maxlength="128" />

                <label for="key">Package Name <span class="tooltip large" data-tooltip="Your package name is generally the applicationId in your app-level build.gradle file."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="key" required autocomplete="off" placeholder="com.company.appname" />

                <hr />

                <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
            </form>
        </li>
        <li>
            <h2 style="display: none">&nbsp;&nbsp;Linux&nbsp;&nbsp;</h2>

            <form
                data-analytics
                data-analytics-activity
                data-analytics-event="submit"
                data-analytics-category="console"
                data-analytics-label="Create Project Platform (Flutter / Linux)"
                data-service="projects.createPlatform"
                data-scope="console"
                data-event="submit"
                data-success="alert,trigger,reset"
                data-success-param-alert-text="Registered new platform successfully"
                data-success-param-trigger-events="projects.createPlatform"
                data-failure="alert"
                data-failure-param-alert-text="Failed to register platform"
                data-failure-param-alert-classname="error">

                <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
                <input type="hidden" name="type" data-ls-bind="flutter-linux" />

                <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My Linux App" maxlength="128" />

                <label for="key">Package Name <span class="tooltip large" data-tooltip="Your application name"><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="key" required autocomplete="off" placeholder="appname" />

                <hr />

                <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
            </form>
        </li>
        <li>
            <h2 style="display: none">&nbsp;&nbsp;MacOS&nbsp;&nbsp;</h2>

            <form
                data-analytics
                data-analytics-activity
                data-analytics-event="submit"
                data-analytics-category="console"
                data-analytics-label="Create Project Platform (Flutter / Mac OS)"
                data-service="projects.createPlatform"
                data-scope="console"
                data-event="submit"
                data-success="alert,trigger,reset"
                data-success-param-alert-text="Registered new platform successfully"
                data-success-param-trigger-events="projects.createPlatform"
                data-failure="alert"
                data-failure-param-alert-text="Failed to register platform"
                data-failure-param-alert-classname="error">

                <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
                <input type="hidden" name="type" data-ls-bind="flutter-macos" />

                <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My Mac OS App" maxlength="128" />

                <label for="key">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="key" required autocomplete="off" placeholder="com.company.appname" />

                <hr />

                <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
            </form>
        </li>
        <li>
            <h2 style="display: none">&nbsp;&nbsp;Windows&nbsp;&nbsp;</h2>

            <form
                data-analytics
                data-analytics-activity
                data-analytics-event="submit"
                data-analytics-category="console"
                data-analytics-label="Create Project Platform (Flutter / Windows)"
                data-service="projects.createPlatform"
                data-scope="console"
                data-event="submit"
                data-success="alert,trigger,reset"
                data-success-param-alert-text="Registered new platform successfully"
                data-success-param-trigger-events="projects.createPlatform"
                data-failure="alert"
                data-failure-param-alert-text="Failed to register platform"
                data-failure-param-alert-classname="error">

                <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
                <input type="hidden" name="type" data-ls-bind="flutter-windows" />

                <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My Windows App" maxlength="128" />

                <label for="key">Package Name <span class="tooltip large" data-tooltip="Your application name"><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="key" required autocomplete="off" placeholder="appname" />

                <hr />

                <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
            </form>
        </li>
    </ul>
</div>

<div data-ui-modal class="modal box close width-large" data-button-alias=".apple-new">
    <button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>

    <h1 class="margin-bottom-xl">Register your Apple App</h1>

    <ul class="phases clear margin-top-negative-small padding" data-ui-phases>
        <li>
            <h2 style="display: none">&nbsp;&nbsp;iOS&nbsp;&nbsp;</h2>

            <form
                    data-analytics
                    data-analytics-activity
                    data-analytics-event="submit"
                    data-analytics-category="console"
                    data-analytics-label="Create Project Platform (Apple / iOS)"
                    data-service="projects.createPlatform"
                    data-scope="console"
                    data-event="submit"
                    data-success="alert,trigger,reset"
                    data-success-param-alert-text="Registered new platform successfully"
                    data-success-param-trigger-events="projects.createPlatform"
                    data-failure="alert"
                    data-failure-param-alert-text="Failed to register platform"
                    data-failure-param-alert-classname="error">

                <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
                <input type="hidden" name="type" data-ls-bind="apple-ios" />

                <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My iOS App" maxlength="128" />

                <label for="key">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="key" required autocomplete="off" placeholder="com.company.appname" />

                <hr />

                <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Back</button>
            </form>

        </li>
        <li>
            <h2 style="display: none">&nbsp;&nbsp;macOS&nbsp;&nbsp;</h2>

            <form
                    data-analytics
                    data-analytics-activity
                    data-analytics-event="submit"
                    data-analytics-category="console"
                    data-analytics-label="Create Project Platform (Apple / macOS)"
                    data-service="projects.createPlatform"
                    data-scope="console"
                    data-event="submit"
                    data-success="alert,trigger,reset"
                    data-success-param-alert-text="Registered new platform successfully"
                    data-success-param-trigger-events="projects.createPlatform"
                    data-failure="alert"
                    data-failure-param-alert-text="Failed to register platform"
                    data-failure-param-alert-classname="error">

                <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
                <input type="hidden" name="type" data-ls-bind="apple-macos" />

                <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My macOS App" maxlength="128" />

                <label for="key">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="key" required autocomplete="off" placeholder="com.company.appname" />

                <hr />

                <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Back</button>
            </form>
        </li>
        <li>
            <h2 style="display: none">&nbsp;&nbsp;watchOS&nbsp;&nbsp;</h2>

            <form
                    data-analytics
                    data-analytics-activity
                    data-analytics-event="submit"
                    data-analytics-category="console"
                    data-analytics-label="Create Project Platform (Apple / watchOS)"
                    data-service="projects.createPlatform"
                    data-scope="console"
                    data-event="submit"
                    data-success="alert,trigger,reset"
                    data-success-param-alert-text="Registered new platform successfully"
                    data-success-param-trigger-events="projects.createPlatform"
                    data-failure="alert"
                    data-failure-param-alert-text="Failed to register platform"
                    data-failure-param-alert-classname="error">

                <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
                <input type="hidden" name="type" data-ls-bind="apple-watchos" />

                <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My watchOS App" maxlength="128" />

                <label for="key">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="key" required autocomplete="off" placeholder="com.company.appname" />

                <hr />

                <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Back</button>
            </form>
        </li>
        <li>
            <h2 style="display: none">&nbsp;&nbsp;tvOS&nbsp;&nbsp;</h2>

            <form
                    data-analytics
                    data-analytics-activity
                    data-analytics-event="submit"
                    data-analytics-category="console"
                    data-analytics-label="Create Project Platform (Apple / tvOS)"
                    data-service="projects.createPlatform"
                    data-scope="console"
                    data-event="submit"
                    data-success="alert,trigger,reset"
                    data-success-param-alert-text="Registered new platform successfully"
                    data-success-param-trigger-events="projects.createPlatform"
                    data-failure="alert"
                    data-failure-param-alert-text="Failed to register platform"
                    data-failure-param-alert-classname="error">

                <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
                <input type="hidden" name="type" data-ls-bind="apple-tvos" />

                <label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="name" required autocomplete="off" placeholder="My tvOS App" maxlength="128" />

                <label for="key">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
                <input type="text" class="full-width" name="key" required autocomplete="off" placeholder="com.company.appname" />

                <hr />

                <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Back</button>
            </form>
        </li>
    </ul>
</div>

<script type="text/html" id="template-ios-update">
    <form
        data-analytics
        data-analytics-activity
        data-analytics-event="submit"
        data-analytics-category="console"
        data-analytics-label="Update Project Platform (iOS)"
        data-service="projects.updatePlatform"
        data-scope="console"
        data-event="submit"
        data-success="alert,trigger"
        data-success-param-alert-text="Updated platform successfully"
        data-success-param-trigger-events="projects.updatePlatform"
        data-failure="alert"
        data-failure-param-alert-text="Failed to update platform"
        data-failure-param-alert-classname="error">

        <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
        <input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />

        <label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
        <input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My iOS App" maxlength="128" />

        <label data-ls-attrs="for=key-{{platform.$id}}">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
        <input name="key" type="text" class="margin-bottom" autocomplete="off" placeholder="com.company.appname" data-ls-bind="{{platform.key}}" required />
        
        <hr />

        <button type="submit">Update</button> &nbsp; <button data-ls-ui-trigger="modal-close" type="button" class="reverse">Cancel</button>
    </form>
</script>

<script type="text/html" id="template-macos-update">
    <form
            data-analytics
            data-analytics-activity
            data-analytics-event="submit"
            data-analytics-category="console"
            data-analytics-label="Update Project Platform (macOS)"
            data-service="projects.updatePlatform"
            data-scope="console"
            data-event="submit"
            data-success="alert,trigger"
            data-success-param-alert-text="Updated platform successfully"
            data-success-param-trigger-events="projects.updatePlatform"
            data-failure="alert"
            data-failure-param-alert-text="Failed to update platform"
            data-failure-param-alert-classname="error">

        <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
        <input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />

        <label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
        <input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My macOS App" maxlength="128" />

        <label data-ls-attrs="for=key-{{platform.$id}}">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
        <input name="key" type="text" class="margin-bottom" autocomplete="off" placeholder="com.company.appname" data-ls-bind="{{platform.key}}" required />

        <hr />

        <button type="submit">Update</button> &nbsp; <button data-ls-ui-trigger="modal-close" type="button" class="reverse">Back</button>
    </form>
</script>

<script type="text/html" id="template-android-update">
    <form
        data-analytics
        data-analytics-event="submit"
        data-analytics-category="console"
        data-analytics-label="Update Project Platform (Flutter / Android)"
        data-service="projects.updatePlatform"
        data-scope="console"
        data-event="submit"
        data-success="alert,trigger"
        data-success-param-alert-text="Updated platform successfully"
        data-success-param-trigger-events="projects.updatePlatform"
        data-failure="alert"
        data-failure-param-alert-text="Failed to update platform"
        data-failure-param-alert-classname="error">

        <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
        <input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />

        <label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
        <input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My Android App" maxlength="128" />

        <label data-ls-attrs="for=key-{{platform.$id}}">Package Name <span class="tooltip large" data-tooltip="Your package name is generally the applicationId in your app-level build.gradle file."><i class="icon-question"></i></span></label>
        <input name="key" type="text" class="margin-bottom" autocomplete="off" placeholder="com.company.appname" data-ls-bind="{{platform.key}}" required />

        <hr />

        <button type="submit">Update</button> &nbsp; <button data-ls-ui-trigger="modal-close" type="button" class="reverse">Cancel</button>
    </form>
</script>

<script type="text/html" id="template-desktop-update">
    <form
        data-analytics
        data-analytics-event="submit"
        data-analytics-category="console"
        data-analytics-label="Update Project Platform (Flutter / Desktop)"
        data-service="projects.updatePlatform"
        data-scope="console"
        data-event="submit"
        data-success="alert,trigger"
        data-success-param-alert-text="Updated platform successfully"
        data-success-param-trigger-events="projects.updatePlatform"
        data-failure="alert"
        data-failure-param-alert-text="Failed to update platform"
        data-failure-param-alert-classname="error">

        <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />

        <input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />

        <label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
        <input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My desktop app" maxlength="128" />

        <label data-ls-attrs="for=key-{{platform.$id}}">App Name <span class="tooltip large" data-tooltip="Your application name"><i class="icon-question"></i></span></label>
        <input name="key" type="text" class="margin-bottom" autocomplete="off" placeholder="appname" data-ls-bind="{{platform.key}}" required />

        <hr />

        <button type="submit">Update</button> &nbsp; <button data-ls-ui-trigger="modal-close" type="button" class="reverse">Cancel</button>
    </form>
</script>

<script type="text/html" id="template-apple-watchos-update">
    <form
            data-analytics
            data-analytics-activity
            data-analytics-event="submit"
            data-analytics-category="console"
            data-analytics-label="Update Project Platform (watchOS)"
            data-service="projects.updatePlatform"
            data-scope="console"
            data-event="submit"
            data-success="alert,trigger"
            data-success-param-alert-text="Updated platform successfully"
            data-success-param-trigger-events="projects.updatePlatform"
            data-failure="alert"
            data-failure-param-alert-text="Failed to update platform"
            data-failure-param-alert-classname="error">

        <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
        <input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />

        <label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
        <input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My watchOS App" maxlength="128" />

        <label data-ls-attrs="for=key-{{platform.$id}}">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
        <input name="key" type="text" class="margin-bottom" autocomplete="off" placeholder="com.company.appname" data-ls-bind="{{platform.key}}" required />

        <hr />

        <button type="submit">Update</button> &nbsp; <button data-ls-ui-trigger="modal-close" type="button" class="reverse">Back</button>
    </form>
</script>

<script type="text/html" id="template-apple-tvos-update">
    <form
            data-analytics
            data-analytics-activity
            data-analytics-event="submit"
            data-analytics-category="console"
            data-analytics-label="Update Project Platform (tvOS)"
            data-service="projects.updatePlatform"
            data-scope="console"
            data-event="submit"
            data-success="alert,trigger"
            data-success-param-alert-text="Updated platform successfully"
            data-success-param-trigger-events="projects.updatePlatform"
            data-failure="alert"
            data-failure-param-alert-text="Failed to update platform"
            data-failure-param-alert-classname="error">

        <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
        <input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />

        <label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
        <input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My tvOS App" maxlength="128" />

        <label data-ls-attrs="for=key-{{platform.$id}}">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
        <input name="key" type="text" class="margin-bottom" autocomplete="off" placeholder="com.company.appname" data-ls-bind="{{platform.key}}" required />

        <hr />

        <button type="submit">Update</button> &nbsp; <button data-ls-ui-trigger="modal-close" type="button" class="reverse">Back</button>
    </form>
</script>

<script type="text/html" id="template-flutter-ios-update">
    <div data-ls-template="template-ios-update" data-type="script"></div>
</script>

<script type="text/html" id="template-flutter-android-update">
    <div data-ls-template="template-android-update" data-type="script"></div>
</script>

<script type="text/html" id="template-flutter-linux-update">
    <div data-ls-template="template-desktop-update" data-type="script"></div>
</script>

<script type="text/html" id="template-flutter-macos-update">
    <div data-ls-template="template-ios-update" data-type="script"></div>
</script>

<script type="text/html" id="template-flutter-windows-update">
    <div data-ls-template="template-desktop-update" data-type="script"></div>
</script>

<script type="text/html" id="template-apple-ios-update">
    <div data-ls-template="template-ios-update" data-type="script"></div>
</script>

<script type="text/html" id="template-apple-macos-update">
    <div data-ls-template="template-macos-update" data-type="script"></div>
</script>
