Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<script>
    $(function(){
        $('.show_item').button({
            icons:
            {
                primary:"ui-icon-extlink"
            }
        }).click(show_item);
        $('#add_preis').button({
            icons:
            {
                primary:"ui-icon-plus"
            }
        }).click(add_preis);
        $('#add_preis_dialog').dialog("destroy").dialog({
            autoOpen:false,
            width:700,
            height:600,
            modal:true,
            resizable:false,
            buttons:
            {
                "speichern": function()
                {
                    $.post("/logins/preisstaffel.php",$('#add_preis_dialog_form').serializeArray(),function(html){
                        //alert(html);
                        login_id=$('#login_id').val();
                        $('#preise_dialog').load("/logins/preise.php?login="+login_id);
                    });
                    $(this).dialog("close");
                },
                "abbrechen": function()
                {
                    $(this).dialog("close");
                }
            }
        });
        $('.edit_preis').button({
            icons:{
                primary: "ui-icon-pencil"
            }
        }).click(edit_preis);
        $('#edit_preis_dialog').dialog("destroy").dialog({
            autoOpen:false,
            width:700,
            modal:true,
            resizable:false,
            buttons:
            {
                "speichern": function()
                {
                    $.post("/logins/preisstaffel.php",$('#edit_preis_dialog_form').serializeArray(),function(html){
                        //alert(html);
                        login_id=$('#login_id').val();
                        $('#preise_dialog').html("").load("/logins/preise.php?login="+login_id);
                    });
                    $(this).dialog("close");
                },
                "abbrechen": function()
                {
                    $(this).dialog("close");
                }
            }
        });
        $('#del_preis_dialog').dialog("destroy").dialog({
            autoOpen:false,
            width:700,
            modal:true,
            resizable:false,
            buttons:
            {
                "löschen": function()
                {
                    $.post("/logins/preisstaffel.php",$('#del_preis_dialog_form').serializeArray(),function(html){
                        //alert(html);
                        login_id=$('#login_id').val();
                        $('#preise_dialog').html("").load("/logins/preise.php?login="+login_id);
                    });
                    $(this).dialog("close");
                },
                "abbrechen": function()
                {
                    $(this).dialog("close");
                }
            }
        });
        $('#suche').keyup(suche);
        $('#shop_id').change(suche);
        function show_item()
        {
            id=this.id;
            id=id.split("_");
            a_id=id[2];
            s_id=id[3];
            $('#preise_dialog').load("/logins/preise.php?a_id="+a_id+"&s_id="+s_id);
            return false;
        }
        function suche()
        {
            $('#ergebnis').load("/logins/suche_artikel.php",$('#add_preis_dialog_form').serializeArray());
        }
        function add_preis()
        {
            $('#preis').hide();
            $("#artikel").hide();
            $('#artikel_suche').show();
            $('#add_preis_dialog').dialog("open");
            return false;
        }
        function edit_preis()
        {
            id=this.id;
            id=id.split("_");
            id=id[2];
            $('#edit_preis_dialog').load("/logins/preisstaffel.php?id="+id).dialog("open");
            return false;
        }
        $('.del_preis').button({
            icons:{
                primary: "ui-icon-trash"
            }
        }).click(del_preis);
        
        function del_preis()
        {
            id=this.id;
            id=id.split("_");
            id=id[2];
            //alert(id);
            $('.del_id').val(id);
            //alert($('.del_id').val());
            $('#del_preis_dialog').dialog("open");
            return false;
        }
    });
</script>
<button id="add_preis" title="neuen Preis zuordnen"></button>
<table width="800">
    <tr>
        <th colspan="8" style="font-size:24px;">Preise für Login {$login_id} - {$daten.login_name}:</th>
    </tr>
    <tr>
        <td>ID</td>
        <td>Artikelnummer</td>
        <td>Artikelname</td>
        <td>Shopnummer</td>
        <td>Shopname</td>
        <td>Shoppreis</td>
        <td>Kundenpreis</td>
        <td>Aktionen</td>
    </tr>
{foreach $daten.artikel as $zeile}
    <tr>
        <td>{$zeile.id}</td>
        <td>{$zeile.artikel_id}</td>
        <td>{$zeile.kurzbezeichnung}</td>
        <td>{$zeile.shop_id}</td>
        <td>{$zeile.name}</td>
        <td>
            {if $zeile.preis1 < 0}
            {$zeile.preis1|abs}%
            {else}
            {$zeile.preis1|money_format}
            {/if}
        </td>
        <td>
            {if $zeile.preis.preis[0] < 0}
            {$zeile.preis.preis[0]|abs}%
            {else}
            {$zeile.preis.preis[0]|money_format}
            {/if}
        </td>
        <td>
            <button id="edit_preis_{$zeile.id}" class="edit_preis" title="ändern"></button>
            <button id="del_preis_{$zeile.id}" class="del_preis" title="löschen"></button>
            <button id="show_item_{$zeile.artikel_id}_{$zeile.shop_id}" class="show_item" title="alle Kundenpreise für diesen Artikel"></button>
        </td>
    </tr>
{/foreach}
</table>

<div id="edit_preis_dialog" title="Preise bearbeiten">
</div>

<div id="add_preis_dialog" title="Artikelpreis zuordnen">
    <form id="add_preis_dialog_form">
        <table>
            <tr>
                <td>Shop</td>
                <td>
                    {html_options options=$shops name="shop_id" id="shop_id"}
                </td>
            </tr>
            <tr id="artikel">
                <td valign="top">Artikel</td>
                <td>
                    <span id="artikel_name"></span>
                    <input type="hidden" name="artikel_id" id="artikel_id" />
                </td>
            </tr>
            <tr id="artikel_suche">
                <td valign="top">Artikelsuche</td>
                <td>
                    <input type="text" name="suche" id="suche" />
                    <div id="ergebnis">
                    </div>
                </td>
            </tr>
            <tr id="preis">
                <td>Preis</td>
                <td>
                    <input type="text" name="staffel[1][preis][0]" value="" />
                    <input type="hidden" name="mode" value="save" />
                    <input type="hidden" name="login_id" value="{$login_id}" />
                </td>
            </tr>
        </table>
    </form>
</div>

<div id="del_preis_dialog" title="Preise löschen">
    <form id="del_preis_dialog_form">
        <table>
            <tr>
                <td>Wollen Sie diese Zuordnung wirklich löschen</td>
                <td>
                    <input type="hidden" name="id" class="del_id" />
                    <input type="hidden" name="mode" value="delete" />
                </td>
            </tr>
        </table>
    </form>
</div>