<form class="ml-3 mr-3" name="shutwakeopt" #shutwakeopt="ngForm">
    <p-card class="m-5">
        <ng-template pTemplate="title">
            {{ 'settings.shutwake.title' | translate }}
        </ng-template>
        <ng-template pTemplate="subtitle">
            {{ 'settings.shutwake.subtitle' | translate }}
        </ng-template>
        <ng-template pTemplate="content">
            <div class="grid">
                <div class="mb-4 w-full">

                    <div class="form-group field">
                        <label for="startupCommand" class="label block">{{ 'settings.shutwake.startcmd_label' | translate
                            }}</label>
                        <input pInputText id="startupCommand" [(ngModel)]="startupCommand" name="startupCommand"
                            class="mb-2 form-control w-full" />
                        <small class="block">
                            {{ 'settings.shutwake.startcmd_desc' | translate }}
                        </small>
                    </div>

                    <div class="form-group field">
                        <p-checkbox inputId="blockSDWUwithoutClient" [(ngModel)]="blockSDWUwithoutClient"
                            name="blockSDWUwithoutClient" class="mb-2 w-full label" [binary]="true"
                            label="{{ 'settings.shutwake.block_label' | translate }}">
                        </p-checkbox>
                        <small class="block">
                            {{ 'settings.shutwake.block_desc' | translate }}
                        </small>
                    </div>

                    <div class="form-group field">
                        <label for="idleTimeoutSecs" class="label block">{{ 'settings.shutwake.idletime_label' | translate
                            }}</label>
                        <p-inputNumber [(ngModel)]="idleTimeoutSecs" name="idleTimeoutSecs" id="idleTimeoutSecs"
                            [showButtons]="true" [min]="0" [max]="1200" [step]="5"></p-inputNumber>
                        <small class="block">
                            {{ 'settings.shutwake.idletime_desc' | translate }}
                        </small>
                    </div>

                    <div class="form-group field">
                        <label for="idleWaitForRecordingTime" class="label block">{{ 'settings.shutwake.maxwait_label' |
                            translate }}</label>
                        <p-inputNumber [(ngModel)]="idleWaitForRecordingTime" name="idleWaitForRecordingTime"
                            id="idleWaitForRecordingTime" [showButtons]="true" [min]="0" [max]="300"
                            [step]="1"></p-inputNumber>
                        <small class="block">
                            {{ 'settings.shutwake.maxwait_desc' | translate }}
                        </small>
                    </div>

                    <div class="form-group field">
                        <label for="StartupSecsBeforeRecording" class="label block">{{ 'settings.shutwake.startbefore_label' |
                            translate }}</label>
                        <p-inputNumber [(ngModel)]="StartupSecsBeforeRecording" name="StartupSecsBeforeRecording"
                            id="StartupSecsBeforeRecording" [showButtons]="true" [min]="0" [max]="300"
                            [step]="1"></p-inputNumber>
                        <small class="block">
                            {{ 'settings.shutwake.startbefore_desc' | translate }}
                        </small>
                    </div>

                    <div class="form-group field">
                        <label for="WakeupTimeFormat" class="label block">{{ 'settings.shutwake.timeformat_label' | translate
                            }}</label>
                        <input pInputText id="WakeupTimeFormat" [(ngModel)]="WakeupTimeFormat" name="WakeupTimeFormat"
                            class="mb-2 form-control w-full" />
                        <small class="block">
                            {{ 'settings.shutwake.timeformat_desc' | translate }}
                        </small>
                    </div>

                    <div class="form-group field">
                        <label for="SetWakeuptimeCommand" class="label block">{{ 'settings.shutwake.timecmd_label' | translate
                            }}</label>
                        <input pInputText id="SetWakeuptimeCommand" [(ngModel)]="SetWakeuptimeCommand"
                            name="SetWakeuptimeCommand" class="mb-2 form-control w-full" />
                        <small class="block">
                            {{ 'settings.shutwake.timecmd_desc' | translate }}
                        </small>
                    </div>

                    <div class="form-group field">
                        <label for="ServerHaltCommand" class="label block">{{ 'settings.shutwake.serverhalt_label' | translate
                            }}</label>
                        <input pInputText id="ServerHaltCommand" [(ngModel)]="ServerHaltCommand"
                            name="ServerHaltCommand" class="mb-2 form-control w-full" />
                        <small class="block">
                            {{ 'settings.shutwake.serverhalt_desc' | translate }}
                        </small>
                    </div>

                    <div class="form-group field">
                        <label for="preSDWUCheckCommand" class="label block">{{ 'settings.shutwake.preshut_label' | translate
                            }}</label>
                        <input pInputText id="preSDWUCheckCommand" [(ngModel)]="preSDWUCheckCommand"
                            name="preSDWUCheckCommand" class="mb-2 form-control w-full" />
                        <small class="block">
                            {{ 'settings.shutwake.preshut_desc' | translate }}
                        </small>
                    </div>

                </div>

            </div>
        </ng-template>

        <ng-template pTemplate="footer">
            <div class="grid nogutter">
                <div class="col-12">
                    <p-message *ngIf="this.successCount > 0 && this.errorCount == 0 && !shutwakeopt.dirty"
                        severity="success" text="{{ 'common.savesuccess' | translate }}"></p-message>
                    <p-message *ngIf="this.errorCount > 0" severity="error"
                        text="{{ 'common.networkfail' | translate }}"></p-message>
                </div>
                <p-button class="col pr-1" label="{{'common.save' | translate}}" icon="pi pi-save" iconPos="left"
                    (onClick)="saveForm(); shutwakeopt.form.markAsPristine()"
                    [disabled]="!shutwakeopt.dirty || setupService.schedulingEnabled"></p-button>
            </div>
        </ng-template>
    </p-card>
</form>