

<div class="row">
    <div class="container">

        <ol class="breadcrumb">
            <li><a href="#">خصائص عامة</a></li>
            <li><a href="partnerwithdrawalController.php?do=show">مسحوبات الشركاء</a></li>
            <li class="active">اضافة سحب</li>
        </ol>


        <div class="panel panel-default panel-m">
            <div class="panel-heading">
                <h3 class="panel-title">اضافة سحب</h3>
            </div>
            <div class="panel-body">

                <form class="form-horizontal" role="form" action="partnerwithdrawalController.php?do=add" method="post" id="submitnew">




                    <div class="form-group">
                        <label for="partnerid" class="col-lg-2 control-label">الشريك</label>
                        <div class="col-lg-4">

                            <span id="spryselect1">
                                <select class="select2 wdt100" name="partnerid" id="partnerid">
                                    <option value="-1">اختر شريك</option>

                                    {foreach $partnerData as $partner}

                                    <option value="{$partner->partnerid}">{$partner->partnername}</option>
                                    {/foreach}

                                </select>
                                <span class="selectInvalidMsg"> *</span></span>

                        </div>
                    </div>

                    <!-- =================================================   -->



                    <!--                    <div class="form-group">
                                            <label for="savecurrentvalue" class="col-lg-2 control-label">قيمة الخزنة الحالية</label>
                                            <div class="col-lg-4">


                                                <div class="input-group">

                                                    <input type="text" name="savecurrentvalue" id="savecurrentvalue" value="{$saveData->savecurrentvalue}" readonly="readonly" class="form-control" />

                                                    <span class="input-group-addon">{$currency}</span>
                                                </div>

                                            </div>
                                        </div>-->

                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="storereporttype" class="col-lg-2 control-label">نوع العملية</label>
                        <div class=" col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" name="partenrwithdrawaltype" id="addvalue" value="0" onclick="showhidediv(this);" checked>
                                    ايداع </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" name="partenrwithdrawaltype" id="discountvalue" value="1" onclick="showhidediv(this);">
                                    سحب </label>
                            </div>
                        </div>
                    </div>

                    <!-- =================================================   -->
                    <div class="form-group">

                        <label for="partnerwithdrawalvalue" class="col-lg-2 control-label" id="two"  >قيمة الايداع</label>

                        <label for="partnerwithdrawalvalue" class="col-lg-2 control-label" id="container"  style="display:none">قيمة السحب</label>



                        <div class="col-lg-4">


                            <div class="input-group">
                                <!--onKeyUp="checksaveValue();"-->

                                <span id="sprytextfield2">
                                    <input type="text" name="partnerwithdrawalvalue" id="partnerwithdrawalvalue" value="0"   class="form-control positivefloat" autocomplete="off" placeholder="قيمة السحب"/>
                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل القيمة صحيحة</span></span>

                                <span class="input-group-addon">{$currency}</span>
                            </div>


                        </div>
                    </div>


                    <!-- =================================================   -->
                    <!--    <div class="form-group">
                          <label for="partnerwithdrawalvalue" class="col-lg-2 control-label">قيمة السحب</label>
                         <div class="col-lg-4">


                          <div class="input-group">


                          <span id="sprytextfield1">
                                       <input type="text" name="partnerwithdrawalvalue" id="partnerwithdrawalvalue" value="0" onKeyUp="checksaveValue();"  class="form-control numberinput" placeholder="قيمة السحب"/>
                                             <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل القيمة صحيحة</span></span>

                   <span class="input-group-addon">{$currency}</span>
                 </div>


                        </div>
                       </div>-->
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">طريقة الدفع</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input value="0"  name="paymethod" id="PMSave" class="PMethod" checked="checked"   type="radio" />

                                    خزنة </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" name="paymethod" id="PMBank" class="PMethod" type="radio" />
                                    بنك </label>
                            </div>

                        </div>
                    </div>
                    <div id="save-div">
                        {if $userData->searchinonesave eq 0}
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الخزنة</label>
                            <div class="col-lg-4">
                                <span id="spryselect3">
                                    <select name="saveid"  id="saveid" class="select2">
                                        <option value="-1">اختر الخزنة</option>
                                        {foreach $allSave as $data}
                                        <option value="{$data->saveid}" {if $userData->saveid == $data->saveid}selected{/if}>{$data->savename}</option>
                                        {/foreach}
                                    </select>
                                    <span class="selectInvalidMsg">اختر الخزنة</span></span>
                            </div>
                        </div>
                        {else}
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الخزنة</label>
                            <div class="col-lg-4">
                                {foreach $allSave as $data}
                                {if $userData->saveid == $data->saveid}{$data->savename}{/if}
                                <input type="hidden" name="saveid" id="saveid" value="{$userData->saveid}"/>
                                {/foreach}
                            </div>
                        </div>
                        {/if}


                    </div>
                    <div id="bank-div" style="display: none">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">البنك</label>
                            <div class="col-lg-4">
                                <span id="spryselect4">
                                    <select name="bankid"  id="bankid" class="select2">
                                        <option value="-1">اختر البنك</option>
                                        {foreach $bank as $data}
                                        <option value="{$data->bankid}">{$data->bankname}</option>
                                        {/foreach}
                                    </select>
                                    <span class="selectInvalidMsg">اختر البنك</span></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الحساب</label>
                            <div class="col-lg-4">
                                <span id="spryselect5">
                                    <select name="bankaccountid"  id="bankaccountid">
                                        <option></option>
                                    </select>
                                    <span class="selectInvalidMsg">اختر الحساب</span></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">رقم الشيك</label>
                            <div class="col-lg-4">
                                <span id="sprytextfield3">
                                    <input name="checkNo" id="checkNo" type="text"   class="form-control" />
                                    <span class="textfieldRequiredMsg">*</span></span>
                            </div>
                        </div>
                    </div>

                    <!-- =================================================   -->


                    <div class="form-group">
                        <label for="comment" class="col-lg-2 control-label">التعليق</label>
                        <div class="col-lg-4">

                            <textarea  class="form-control" rows="3" name="comment"></textarea>

                        </div>
                    </div>

                    <!-- =================================================   -->

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="button"  class="btn btn-primary pull-left submitnew">حفظ الامر</button>
                        </div>
                    </div>




                </form>
            </div>
        </div>




    </div>
</div>



{literal}

<script type="text/javascript">


    

    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "real");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {isRequired: false, invalidValue: "-1"});
    var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {invalidValue: "-1", isRequired: false});
    var spryselect4 = '';
    var spryselect5 = '';
    var sprytextfield3 = '';
    $(".PMethod").live('change', function () {
        var whatis = $(this).val();
        if (whatis == 0) {
            $('#save-div').show();
            $('#bank-div').hide();
            spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {invalidValue: "-1", isRequired: false});
            spryselect4.destroy();
            spryselect5.destroy();
            sprytextfield3.destroy();
        } else if (whatis == 1) {
            $('#save-div').hide();
            $('#bank-div').show();
            spryselect3.destroy();
            spryselect4 = new Spry.Widget.ValidationSelect("spryselect4", {invalidValue: "-1", isRequired: false});
            spryselect5 = new Spry.Widget.ValidationSelect("spryselect5");
            sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
        }

    });
    $("#bankid").live('change', function () {
        var id = $(this).val();
        $.post("projectControllerAjax.php?do=getbankaccount", {id: id}, function (data) {
            $("#bankaccountid").html(data);
        });
    });
</script>
{/literal}
{literal}
<script type="text/javascript">

    function showhidediv(rad) {
        var rads = document.getElementsByName(rad.name);
        document.getElementById('two').style.display = (rads[0].checked) ? 'block' : 'none';
        document.getElementById('container').style.display = (rads[1].checked) ? 'block' : 'none';
        $("#partnerwithdrawalvalue").val(0);
    }
</script>
{/literal}
