@extends('layouts.layouts_index.main')

@section('title', 'EndoINDEX')
@section('style')
    <meta name="csrf-token" content="{{ csrf_token() }}" />
    <link href="{{ url('public/css/superadmin/index.css') }}" rel="stylesheet" type="text/css" />
@endsection
<style>
    .superadmin-text {
        padding-left: 47em !important;
        padding: 1em 0 1em;
    }
</style>
@section('content')
    @php

    @endphp

    @php
        $admin['controllername'] = 'endocapture/SuperadminController';
        $admin['viewname'] = 'superdamin';
        cardADMIN($admin);
    @endphp

    <div class="row m-0">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <div class="row">
                        <div class="col-12 mb-3">
                            <h2 style="text-align: center;">การเปิดปิดการใช้งานระบบหลัก</h2>
                        </div>
                        @include('EndoCAPTURE.superadmin.component.menutopbar')

                        @php
                            $swicth = 'EndoCAPTURE/superadmin/component/switch';
                            $textbox = 'EndoCAPTURE/superadmin/component/textbox';
                        @endphp
                        @component($textbox, ['type' => 'admin', 'name' => 'App Name', 'id' => 'app_name'])
                        @endcomponent
                        @component($textbox, ['type' => 'admin', 'name' => 'Port number', 'id' => 'port_number'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'SYSTEM Queue', 'id' => 'system_queue'])
                        @endcomponent
                        <div class="col-4"></div>
                        <div class="col-8">
                            <input type        = "text" config_type = "queue" name        = "url"
                                class       = "form-control form-control-lg text-center config_type" id          = "url"
                                style       = "border-radius: 25px;" value       = "{{ configTYPE('queue', 'url') }}">
                        </div>
                        @component($swicth, ['type' => 'admin', 'name' => 'SYSTEM Semi', 'id' => 'system_semi'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'API Token Update', 'id' => 'api_token_update'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'SYSTEM Book', 'id' => 'system_book'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'Camera Python', 'id' => 'camera_python'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'Lumina', 'id' => 'lumina'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'SYSTEM PACs', 'id' => 'system_pacs'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'SYSTEM PACsPYTHON', 'id' => 'system_pacspython'])
                        @endcomponent

                        @component($swicth, ['type' => 'admin', 'name' => 'SYSTEM EMR', 'id' => 'system_emr'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'SYSTEM VNA', 'id' => 'system_vna'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'SYSTEM ORDATA', 'id' => 'system_ordata'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'CheckPHOTOBLACK', 'id' => 'checkphotoblack'])
                        @endcomponent
                        @component($swicth, ['type' => 'required', 'name' => 'Required Allergy(แพ้ยา)', 'id' => 'allergy'])
                        @endcomponent
                        @component($swicth, ['type' => 'required', 'name' => 'Required Pre-diagnosis', 'id' => 'prediagnosis'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'Index Sendto Video', 'id' => 'sendto_vdo'])
                        @endcomponent

                        <div class="col-12">
                            <hr>
                        </div>

                        @component($swicth, ['type' => 'admin', 'name' => 'PDF findding normal', 'id' => 'pdf_findding_normal'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'hidden select users', 'id' => 'hidden_select_user'])
                        @endcomponent
                        @component($textbox, ['type' => 'pdf', 'name' => 'PDF Folder HEAD Hospital', 'id' => 'pdf_folder_head'])
                        @endcomponent
                        @component($textbox, ['type' => 'admin', 'name' => 'PDF Procedure pic', 'id' => 'pdf_procedure_pic'])
                        @endcomponent
                        @component($textbox, ['type' => 'admin', 'name' => 'pdf_exit', 'id' => 'pdf_exit'])
                        @endcomponent

                        @component($textbox, ['type' => 'pdf', 'name' => 'pdf_page_margin_top', 'id' => 'pdf_page_margin_top'])
                        @endcomponent
                        @component($textbox, ['type' => 'pdf', 'name' => 'pdf_header_margin_top', 'id' => 'pdf_header_margin_top'])
                        @endcomponent
                        @component($textbox, ['type' => 'pdf', 'name' => 'pdf_content_left_top', 'id' => 'pdf_content_left_top'])
                        @endcomponent
                        @component($textbox, ['type' => 'pdf', 'name' => 'pdf_content_right_top', 'id' => 'pdf_content_right_top'])
                        @endcomponent

                        <div class="col-3">
                            <h3>pdf_default&emsp;&nbsp;</h3>
                        </div>
                        <div class="col-1"></div>
                        <div class="col-6">
                            <select id="pdf_default" class="form-control configtext">
                                <option value="auto" @if (@$connection->pdf_default == 'auto') selected @endif>auto</option>
                                <option value="procedure" @if (@$connection->pdf_default == 'procedure') selected @endif>procedure
                                </option>
                                <option value="long_writing" @if (@$connection->pdf_default == 'long_writing') selected @endif>long_writing
                                </option>
                                <option value="drawing" @if (@$connection->pdf_default == 'drawing') selected @endif>drawing</option>
                                <option value="long_image" @if (@$connection->pdf_default == 'long_image') selected @endif>long_image
                                </option>
                                <option value="pdf_picturebottom" @if (@$connection->pdf_default == 'pdf_picturebottom') selected @endif>
                                    pdf_picturebottom</option>
                            </select>
                        </div>

                        <div class="col-12">
                            <hr>
                        </div>

                        @component($textbox, ['type' => 'queue', 'name' => 'Queue print ip', 'id' => 'queue_print_ip'])
                        @endcomponent
                        @component($textbox, ['type' => 'admin', 'name' => 'Year of installation', 'id' => 'year_install'])
                        @endcomponent
                        @component($textbox, ['type' => 'hospital', 'name' => 'Hospital CODE', 'id' => 'hospital_code'])
                        @endcomponent
                        @component($textbox, ['type' => 'hospital', 'name' => 'Hospital NAME', 'id' => 'hospital_name'])
                        @endcomponent
                        @component($textbox, ['type' => 'path', 'name' => 'EMR Drive', 'id' => 'path_emr'])
                        @endcomponent

                        @component($textbox, ['type' => 'admin', 'name' => 'Server url', 'id' => 'server_url'])
                        @endcomponent
                        @component($textbox, ['type' => 'admin', 'name' => 'Server name', 'id' => 'server_name'])
                        @endcomponent
                        @component($textbox, ['type' => 'admin', 'name' => 'Com name', 'id' => 'com_name'])
                        @endcomponent

                        @component($textbox, ['type' => 'admin', 'name' => 'Com TYPE', 'id' => 'com_type'])
                        @endcomponent
                        <div class="col-12 superadmin-text">
                            <span class="h5 text-danger">Comtype *</span>
                            <span class="h6">["server","client","standalone"]</span>

                        </div>
                        @component($textbox, ['type' => 'admin', 'name' => 'IP Address', 'id' => 'ipaddress'])
                        @endcomponent
                        @component($textbox, ['type' => 'admin', 'name' => 'Client IP Address', 'id' => 'ipaddress_client'])
                        @endcomponent


                        @component($textbox, ['type' => 'admin', 'name' => 'vdo_minute', 'id' => 'vdo_minute'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'camera_auto_start_time', 'id' => 'camera_auto_start_time'])
                        @endcomponent
                        @component($textbox, ['type' => 'admin', 'name' => 'ALL Client', 'id' => 'all_client'])
                        @endcomponent

                        @component($swicth, ['type' => 'admin', 'name' => 'Signature', 'id' => 'system_esign'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'Signature Auto', 'id' => 'system_esign_auto'])
                        @endcomponent

                        @component($swicth, ['type' => 'admin', 'name' => 'Nurse Monitor', 'id' => 'system_nurse_monitor'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'Nurse Project', 'id' => 'project_nurse'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'Menu Left Big & Small', 'id' => 'menu_left_big_small'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'Menu Left Auto', 'id' => 'menu_left_auto'])
                        @endcomponent
                        @component($swicth, ['type' => 'admin', 'name' => 'topical', 'id' => 'topical'])
                        @endcomponent

                        @component($textbox, ['type' => 'admin', 'name' => 'https:', 'id' => 'https'])
                        @endcomponent

                        <div class="col-4"></div>
                        <div class="col-8">d:\xampp\htdocs\</div>

                        @component($textbox, ['type' => 'admin', 'name' => 'htdocs PATH', 'id' => 'htdocs_path'])
                        @endcomponent
                        @component($textbox, ['type' => 'path', 'name' => 'htdocs BASE', 'id' => 'htdocs_base'])
                        @endcomponent
                        <div class="col-4"></div>
                        <div class="col-8">http://store.medicaendo.com/<br>http://localhost/store/</div>
                        @component($textbox, ['type' => 'admin', 'name' => 'Store URL', 'id' => 'store_url'])
                        @endcomponent
                        @component($textbox, ['type' => 'admin', 'name' => 'Endosmart URL', 'id' => 'endosmart_url'])
                        @endcomponent



                        @component($textbox, ['type' => 'admin', 'name' => '', 'id' => 'room_name'])
                        @endcomponent


                        @component($textbox, ['type' => 'admin', 'name' => 'VDO Setting', 'id' => 'vdo_dir'])
                        @endcomponent
                        @component($textbox, ['type' => 'admin', 'name' => 'VDO URL', 'id' => 'vdo_url'])
                        @endcomponent


                    </div>

                    <div class="row">
                        <div class="col-3 text-right">
                            <h3>Migration Case</h3>
                        </div>
                        <div class="col"><a href="{{ url('migratdata') }}" class="btn btn-primary">Migration</a></div>
                    </div>

                    <form action="{{ url('superadmin') }}" method="POST" class="row mt-2 cn">
                        @csrf
                        @method('POST')
                        <input type="hidden" name="event" value="update_patient">
                        <div class="col-3 text-right">
                            <h3>Peatient Data</h3>
                        </div>
                        <div class="col"><button type="submit" class="btn btn-primary">Update patient</button></div>
                    </form>
                </div>
            </div>
        </div>
    </div>


@endsection
@section('script')
    <script>
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });

        $(".config_type").focusout(function() {
            var value = $(this).val();
            console.log('a');
            var id = $(this).attr('id');
            var config_type = $(this).attr('config_type');
            $.post("{{ url('superadmin') }}", {
                event: "config_type",
                config_type: config_type,
                id: id,
                value: value,
            }, function(data, status) {});
        });


        $(".configtext").focusout(function() {
            var value = $(this).val();
            console.log('b');

            var id = $(this).attr('id');
            $.post("{{ url('jquery') }}", {
                event: "configtext",
                id: id,
                value: value,
            }, function(data, status) {});
        });

        $('.config_option').click(function() {
            var id = $(this).attr('id');
            console.log('c');

            var config_type = $(this).attr('config_type');
            var value = true;
            if ($(this).prop("checked") == false) {
                value = 'false';
            }
            $.post("{{ url('jquery') }}", {
                event: "configcheck",
                id: id,
                config_type: config_type,
                value: value,
            }, function(data, status) {
                console.log(data);
            });
        });


        $(".aaa").focusout(function() {
            alert(1)

        });
    </script>




@endsection
