$(function () {

    $.validator.addMethod("letters", function (value, element) {
        return this.optional(element) || value == value.match(/^[a-zA-Z\s]*$/) || value == value.match(/^[\u0621-\u064A ]+$/);
    });

    'use strict';
    var $form = $("#form-update-doctor");
    $form.validate({
        lang: 'ar',
        rules: {
            name: {
                required: true,
            },
            phone: {
                required: true,
                number : true
            },
            email: {
                required: true,
                email : true
            },
            job_title_ar: {
                required: true,
            },
            job_title_en: {
                required: true,
            },
            job_desc_ar: {
                required: true,
            },
            job_desc_en: {
                required: true,
            },
            about_doc_ar: {
                required: true,
            },
            about_doc_en: {
                required: true,
            },
            image: {
                // required: true,
            },
        },

        messages: {

        },
        submitHandler: function () {
            $form[0].submit();
        }
    });

});















$(document).on('click', '.add_item_exprince', function () {

    var item = `<div class="row item">
                    <div class="col-5">
                        <div class="form-group">
                            <input type="text" class="form-control" value="" name="exprince_ar[]" placeholder="الخبرة المهنية بالعربي" />
                        </div>
                    </div>
                    <div class="col-5">
                        <div class="form-group">
                            <input type="text" class="form-control" value="" name="exprince_en[]" placeholder="الخبرة المهنية بالعربي" />
                        </div>
                    </div>
                    <div class="col-2">
                        <div class="form-group" id="dis_content_en">

                            <button class="btn btn-danger delete_item_exprince" type="button"><i class="fa fa-trash"></i></button>

                        </div>
                    </div>
                </div>`;

    $('.append_here_exprince').append(item);


});


$(document).on('click', '.delete_item_exprince', function () {

    $(this).closest('.item').remove();

});